I've noticed that string refs are considered legacy in React. You can read more about it here: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
However, I am encountering a flow error in my component and I'm unsure how to resolve it:
[flow] Cannot assign `c` to `this.loginform` because property `loginform` is missing in `LoginScreen` [1]. (References: [1])
This is the code snippet of my component:
/**
* @flow
*/
// ... imports, tcomb form model, etcetera ...
class LoginScreen extends React.Component<*> {
onPress() {
var creds = this.loginform.getValue();
orbRequestLogin(this.props.navigation, creds, '/oauth/token');
}
render() {
return (
<Wrap bgcolor="white">
<Content>
<KeyboardAvoidingView behavior="padding">
<Form ref={(c) => { this.loginform = c; }} type={User} options={options} />
<TouchableHighlight style={styles.button} onPress={this.onPress.bind(this)}>
<Text style={styles.buttonText}>Log in</Text>
</TouchableHighlight>
</KeyboardAvoidingView>
</Content>
</Wrap>
);
}
}
export default withNavigation(LoginScreen);