Skip to content
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

TextInput, unrecognized selector sent to instance XXX onChangeText #14583

Closed
awitherow opened this issue Jun 18, 2017 · 1 comment
Closed

TextInput, unrecognized selector sent to instance XXX onChangeText #14583

awitherow opened this issue Jun 18, 2017 · 1 comment
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@awitherow
Copy link
Contributor

awitherow commented Jun 18, 2017

Description

I have a text input,

<TextInput
    style={styles.input}
    onChangeText={text => this.setState({ username: text })}
    value={username }
    editable
    placeholder={!Boolean(username) && 'Username'}
    />

When I attempt to put in the first change of text, this error gets thrown for iOS.

I am using the create-react-native-app and am unsure if this is a react-native issue or an expo, or whatever else in this stack... not very easy to debug to me.

screen shot 2017-06-18 at 16 30 31

Reproduction Steps

https://github.com/awitherow/sales-admin-app/pull/3

Set up, run with Expo XDE and use iOS simulator. Go to IDENTITY tab and attempt to log in.

Sample Code

//@flow
import React from 'react';
import {
    KeyboardAvoidingView,
    View,
    Text,
    TouchableOpacity,
    StyleSheet,
    TextInput,
    Platform,
} from 'react-native';

import { components, metrics, colors } from '../../theme';

export default class Security extends React.Component {
    constructor(props) {
        super(props);

        this.state = {
            username: '',
            password: '',
        };
    }

    validateForm = () =>
        this.state.username.length > 0 && this.state.password.length > 0;

    render() {
        const { username, password } = this.state;

        return (
            <View style={styles.form}>
                <View style={styles.formHeader}>
                    <Text style={[styles.heading, styles.text]}>
                        Welcome to the Marketplace.
                    </Text>
                    <Text style={[styles.subHeading, styles.text]}>
                        Login, or register, below.
                    </Text>
                </View>
                <KeyboardAvoidingView style={styles.formBody}>
                    <TextInput
                        style={styles.input}
                        onChangeText={text => this.setState({ username: text })}
                        value={username || ''}
                        editable
                        placeholder={!Boolean(username) && 'Username'}
                    />
                    <TextInput
                        style={styles.input}
                        onChangeText={text => this.setState({ password: text })}
                        value={password || ''}
                        editable
                        placeholder={!Boolean(password) && 'Password'}
                        secureTextEntry
                    />
                </KeyboardAvoidingView>
                <View style={styles.formFooter}>
                    <TouchableOpacity style={styles.button}>
                        <Text style={styles.buttonText}>Login</Text>
                    </TouchableOpacity>
                    <TouchableOpacity style={styles.button}>
                        <Text style={styles.buttonText}>Register</Text>
                    </TouchableOpacity>
                    <TouchableOpacity style={styles.button}>
                        <Text style={styles.buttonText}>Learn More</Text>
                    </TouchableOpacity>
                </View>
            </View>
        );
    }
}

Solution

Not sure where this is coming from or if I need to make this ticket in another part of this stack.

Additional Information

  • React Native version: 0.44
  • Platform: iOS
  • Development Operating System: OS X
  • Build tools: Create-React-Native-App
@awitherow
Copy link
Contributor Author

iOS does not play nicely with my pointless Boolean placeholder check. It was an implementation mistake 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants