-
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
for SegmentedControlIOS component,onChange(event),event.nativeEvent =null #1310
Labels
Resolution: Locked
This issue was locked by the bot.
Comments
use event.nativeEvent.selectedSegmentIndex |
@donghanji Did this resolve your issue? |
thanks everyone ^_^.sorry to being late. var EventSegmentedControlExample=React.createClass({ getInitialState(){ return { values:['One','Two','Three'], value:'Not selected', selectedIndex:undefined }; }, render(){ return( <View> <Text style={styles.text}> Value:{this.state.value} </Text> <Text style={styles.text}> Index:{this.state.selectedIndex} </Text> <SegmentedControlIOS values={this.state.values} selectedIndex={this.state.selectedIndex} onChange={this._onChange} onValueChange={this._onValueChange} /> </View> ); }, _onChange(event){ console.log(event.nativeEvent);//debug console log here this.setState({ selectedIndex:event.nativeEvent.selectedSegmentIndex }); }, _onValueChange(value){ this.setState({ value:value }); } }); // after changed ,it work well. Whether those changes should be updated,http://facebook.github.io/react-native/docs/segmentedcontrolios.html#content thanks everyone again. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
for SegmentedControlIOS component,when used onChange event,the callback param event,event.nativeEvent is null,no selectedIndex attribute.
this is console log:
the SegmentedControlIOS is a new component,is this an bug?
The text was updated successfully, but these errors were encountered: