Skip to content

Initially disabled button won't enabled after #35

@tavrez

Description

@tavrez
  OS: Windows 10
  Node: 8.11.3
  Yarn: 1.9.2
  npm: 6.2.0
  Watchman: Not Found
  Xcode: N/A
  Android Studio: Not Found

Packages: (wanted => installed)
  react: 16.3.1 => 16.3.1
  react-native: 0.55.4 => 0.55.4

react-native-button-component: 0.2.28

Using this code:

import React, { Component } from 'react';
import {
  StyleSheet,
  View,
  TextInput,
} from 'react-native';
import { RoundButton } from 'react-native-button-component';

export default class App extends Component<Props> {
  constructor(props){
	  super(props);
	  this.state = {password:''};
  }
  render() {
	let {password} = this.state;
    return (
      <View style={styles.container}>
        <TextInput onChangeText={(password) => this.setState({password})} value={password}/>
	<RoundButton text='Submit' disabled={!password}/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
}});

When state is initiated with empty value, the RoundButton get disabled but won't become enabled after.
However, if you set initial state to non-empty, it works as expected(disabled when input become empty)
Edit: Tested on Android
Edit 2 : same as #26 but it's not fixed(as discussed there)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions