-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
What components are coming? #53
Comments
We have the following right now, but they are of varying degrees of completeness.
|
Is there a reason why Button is not on the list? (just curious :-)) |
Yeah, there's a cost of bridging elements, it turns out that reimplementing a button in pure JS is easier than trying to fit the iOS button api with React. Also, since the new iOS, a button is just a label with no real styling associated. We do have TouchableHighlight and TouchableOpacity components to make sure interactions are working correctly. |
What's the approach with non-UI libraries? How should I for instance expose something like UIDevice (which gives device information)? I could imagine something like:
|
We are working on a lightweight store for device APIs, which we call var myComponent = React.createClass({
mixins: [Subscribable.Mixin],
getInitialState: function() {
return {
isConnected: AppState.networkReachability.get() !== 'none'
};
},
componentDidMount: function() {
this._reachSubscription = this.subscribeTo(
AppState.networkReachability,
(reachability) => {
this.setState({ isConnected: reachability !== 'none' })
}
);
},
render: function() {
return (
<Text>
{this.state.isConnected ? 'Network Connected' : 'No network'}
<Text onPress={() => this._reachSubscription.remove()}>
End reachability subscription
</Text>
</Text>
);
}
}); A subscribable is created with an event emitter. For device events, we wrap an internal EventEmitter called AppState.networkReachability = new Subscribable(
RCTDeviceEventEmitter,
'reachabilityDidChange',
(resp) => resp.network_reachability,
RCTReachability.getCurrentReachability
); Why are we wrapping EventEmitter with this new thing? A few reasons:
Feedback is welcome- this API isn't final!
|
Looks sensible. I like the general rule of avoiding string literals. |
We have a mechanism for exporting constants for JS to consume which can be trivially used to provide device info like screen dimensions, number of processor cores, etc. We'll probably migrate over our internal RCTDevice module soon.
|
@vjeux do you know if the CameraIOS component will be released anytime soon? I wanted to use the native camera but wasn't sure if I should implement something in the meanwhile or wait for the CameraIOS you mentioned. Thanks! |
We don't have any Camera implementation inside of Facebook and don't have any project lined up that needs it. Hopefully someone from the community will be able to build it :) |
@vjeux Thanks for the heads up! In that case, maybe I should go ahead and build a component and share it :) |
We do have a camera component internally, but it's not longer used so is probably pretty crusty.
|
If you're looking for ideas, would be cool if I could open a share dialog (UIActivityViewController) using js. |
+1 for CameraIOS |
@ericvicenti - I like that! I assume that calling |
Most of the components on this list have been exported, will close this one. Let's recreate an issue |
I'd like to implement an existing IOS component inside React Native, but would prefer to pick something that isn't already implemented by Facebook. Would be great if you guys could clarify the future plans of React Native a bit more, so we could also help out :-).
The text was updated successfully, but these errors were encountered: