-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Public Interface] Create whitelist internal modules that need to be exposed publicly #1821
Comments
Dimensions is a big one. Many of the prop types are either exported or you can write View.propTypes, Text.propTypes, etc. |
precomputeStyle is one that I think people (me included) use frequently |
Very comprehensive @brentvatne. Looking over your candidates for inclusion here are some of my thoughts:
|
- Future-proofs for later RN versions (via: facebook/react-native#1821)
@brentvatne Thanks again for pointing this out. 👍 |
Yes, this is a great list! This is a minor issue but it seems that cssVar should be removed from this example, given it's no longer exported (and probably shouldn't be).
I'm going to file a bug for it to be removed from react-native-navbar here: https://github.com/Kureev/react-native-navbar/blob/master/index.js#L15 In general, are there any tests in place that ensure the files in the example directory perform properly? I noticed the travis config but didn't dive into the details for how it's used. |
There are, but they don't cover every example. The UIExplorer examples that are specifically tested via snapshots are Layout, Slider, Switch, TabBar, Text, and View. Other functionality (but not the specific screens in UIExplorer) are tested via unit tests and JS integration tests. |
As per #1896 (comment) I think that Subscribable should also be added to the exports |
Yep they look unused. |
ReactNativeART appears to be missing as well |
What about TextInputState? I often use TextInputState.blurTextInput(
TextInputState.currentlyFocusedField()
); to blur input & dismiss keyboard if I don't have ref to what is currently focused. This is handy for example when pushing a new route to Navigator or in the Navigator onWillFocus event. |
I could never understand TextInputState. Thanks for the example @orktes. Seems really useful. @brentvatne I think Input State should be documented. I don't fully understand it to PR. |
We should definitely try to minimize the number of top-level things exported off of react-native. We can hang TextInputState off of TextInput, and similar for other stuff like StyleSheet utilities. What do people use precomputeStyle for? Stuff like ViewStylePropTypes shouldn't be necessary because you can usually just use View.propTypes.style. |
@sahrens - if you need to use Agreed re: |
Let's expose StyleSheet.Registry then. Any pitfalls to doing so, keeping future StyleSheet optimizations in mind? About ViewStylePropTypes -- I imagine people extend it when their components accept more styles than plain Views, similar to what Text does. |
@brentvatne that's a bug, setNativeProps does call precomputeStyle: https://github.com/facebook/react-native/blob/master/Libraries/ReactIOS/NativeMethodsMixin.js#L105 |
What are folks using StyleSheet.Registry for?
|
Would be great to also expose |
I'm going to get a pull request in for an updated list of modules a week from today, please comment on here if a module that you are using has not been discussed above! |
This still seems like something that is important to fix. Sorry for not getting that PR in, other things got in the way. @vjeux - would you like a PR for this still? |
Yeah, we need to include it properly. Let's schedule a meeting on monday so we can go over all them in person and figure out a plan. |
@vjeux - sounds good, I have a few meetings scheduled for Monday already but if 10am or 1pm work for you I can call in |
Moving discussion to PR |
Summary: - TextInputState as TextInput.State - Touchable - flattenStyle as StyleSheet.flatten - ReactNativeART as ART Original discussion in facebook#1821 Closes facebook#3308 Reviewed By: sebmarkbage Differential Revision: D2527152 Pulled By: javache fb-gh-sync-id: 19d4ef9d4c0e6587b9f0793e1ca624aebb034f3b
Summary: - TextInputState as TextInput.State - Touchable - flattenStyle as StyleSheet.flatten - ReactNativeART as ART Original discussion in facebook#1821 Closes facebook#3308 Reviewed By: sebmarkbage Differential Revision: D2527152 Pulled By: javache fb-gh-sync-id: 19d4ef9d4c0e6587b9f0793e1ca624aebb034f3b
after i update the react-native. I got this error, "undefined is not an object (evaluating 'React.PropTypes.bool')". |
As pointed out in #1808, on 0.7.0-rc+ requiring modules that are internal to React Native (eg:
require('NativeModules')
rather thanvar { NativeModules } = require('react-native')
) is not supported going forward. The new behavior is correct, so we need to help people transition away from the old way. A good example of using this incorrect behavior to access internals can be seen on my react-native-video project.The purpose of this issue is to ensure that we publicly expose every module that is necessary to build libraries and apps - to do this we simply have to make a whitelist of those modules and add them to react-native.js)
Please add to this issue with internal modules that you use on your projects that are not already listed here. Thanks!
cc @vjeux @amasad
The text was updated successfully, but these errors were encountered: