Skip to content

Fix documentation links to source code#3634

Closed
1mike12 wants to merge 6 commits into
react:mainfrom
1mike12:fix_documentation_links
Closed

Fix documentation links to source code#3634
1mike12 wants to merge 6 commits into
react:mainfrom
1mike12:fix_documentation_links

Conversation

@1mike12

@1mike12 1mike12 commented Mar 21, 2023

Copy link
Copy Markdown

I originally found one broken link in the docs and made a quick patch, but @cortinico mentioned it would be nice to backport to older versions of the documentation #3633 . That's when I realized there were a lot of broken links. Most of them have to do with the pattern of the folders moving into the packages/react-native/ subdirectory.

For instance

https://github.com/facebook/react-native/blob/master/React.podspec
to
https://github.com/facebook/react-native/blob/main/packages/react-native/React.podspec

The master/main url is auto forwarded by github, but while fixing the links I figured it would make sense to just rewrite any masters to main

All the changes were done via regex replace everywhere. I spot tested various links before writing the various regex's and tried to write the patterns to be fairly targeted. I then randomly sampled some links manually to make sure nothing out of the ordinary was going on. Although with so many links I guess there could be a mistake somewhere. Inside the commit messages, I wrote down the exact patterns used

There are still some broken links after this sweep. An example is the following links that only exist in older documentation relating to the custom webviews. I cant figure out where this is ( or if already deprecated since 0.63+) and doesn't really exist anymore
https://github.com/facebook/react-native/blob/master/React/Views/RCTWebViewManager.m
https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java

@netlify

netlify Bot commented Mar 21, 2023

Copy link
Copy Markdown

Deploy Preview for react-native ready!

Name Link
🔨 Latest commit 972697a
🔍 Latest deploy log https://app.netlify.com/sites/react-native/deploys/6419ba2f59479d000851cbb6
😎 Deploy Preview https://deploy-preview-3634--react-native.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@1mike12 1mike12 changed the title Fix documentation links Fix documentation links to source code Mar 21, 2023
```

> Note that `RCTRootView initWithURL` starts up a new JSC VM. To save resources and simplify the communication between RN views in different parts of your native app, you can have multiple views powered by React Native that are associated with a single JS runtime. To do that, instead of using `[RCTRootView alloc] initWithURL`, use [`RCTBridge initWithBundleURL`](https://github.com/facebook/react-native/blob/master/React/Base/RCTBridge.h#L93) to create a bridge and then use `RCTRootView initWithBridge`.
> Note that `RCTRootView initWithURL` starts up a new JSC VM. To save resources and simplify the communication between RN views in different parts of your native app, you can have multiple views powered by React Native that are associated with a single JS runtime. To do that, instead of using `[RCTRootView alloc] initWithURL`, use [`RCTBridge initWithBundleURL`](https://github.com/facebook/react-native/blob/main/packages/react-native/React/Base/RCTBridge.h#L93) to create a bridge and then use `RCTRootView initWithBridge`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all of these versioned documents, maybe we should keep the existing organization, but point to e.g. 0.60-stable instead of master/main?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that makes the most sense, but it would be a lot harder and require a bit manual intervention. I don't think I would have the time to do that right now unfortunately, but what I could do is at least get the current docs pointed at the right place and save the older ones for later?

@Simek Simek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were discussing replacing those link with @cortinico in one of the other PRs, and we decided that in versioned docs we should use release branches instead of main, for example stable-0.60.

@cortinico

Copy link
Copy Markdown
Contributor

We were discussing replacing those link with @cortinico in one of the other PRs, and we decided that in versioned docs we should use release branches instead of main, for example stable-0.60.

yup this would be the preferred solution

@NickGerleman

NickGerleman commented Mar 24, 2023

Copy link
Copy Markdown
Contributor

We were discussing replacing those link with @cortinico in one of the other PRs, and we decided that in versioned docs we should use release branches instead of main, for example stable-0.60.

yup this would be the preferred solution

@1mike12 had mentioned above he may not have the time to contribute this. #3634 (comment) Maybe we should merge this, to bring back parity to the old state, then iterate if we want to maybe script something to do this?

@Simek

Simek commented Mar 25, 2023

Copy link
Copy Markdown
Collaborator

Maybe we should merge this, to bring back parity to the old state, then iterate if we want to maybe script something to do this?

The problem with this approach is that this PR has changed not only the branch, but also path of old, versioned links paths, which would make switching to the release branch in the future more difficult for the person who want to tackle that.

Saying that, I can prepare a PR which addresses all of the problematic links in the way as we want this weekend, so we can solve issues related to the repository structure changes, nad move forward on that.

@Simek

Simek commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

Hey @1mike12, recently we have introduced the helpers for repository link based on the current docs version which user browse:

Would you be interested in updating the PR using them?

@Simek

Simek commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Hey @1mike12, looks like there is a lot of conflicts and it would be a bit of messy task to resolve them after the changes mentioned in the comment above.

If you still want to help us alter the link please create a new PR using the mentioned utils instead a hardcoded links per version.

@Simek Simek closed this May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants