Skip to content

Don't see numbers inputted  #235

Open
@Viktor-as

Description

Hey,

basically I was having the same problem as in this issue.

On most of the phones that I tested everything was ok, but on some (like Huawei pro 20 (Android 10)) the numbers that you input were not shown.

Accidently discovered that if you specify the colors for cursor (like here) and for input - then everything is ok, and I started seeing my input also on Huawei Pro 20.

Maybe this could be fixed or added to the documentation. Hope this helps.

                       <CodeField
                          ref={ref}
                          {...props}
                          value={value}
                          onChangeText={val => {
                            setFieldValue('code', val);
                            setValue(val);
                          }}
                          cellCount={CELL_COUNT}
                          rootStyle={styles.codeFieldRoot}
                          keyboardType="number-pad"
                          textContentType="oneTimeCode"
                          renderCell={({index, symbol, isFocused}) => (
                            <Text
                              key={index}
                              style={[
                                styles.cell,
                                isFocused && styles.focusCell,
                              ]}
                              onLayout={getCellOnLayoutHandler(index)}>
                              {symbol ||
                                (isFocused ? (
                                  <Text style={{color: '#000'}}> // ← this line -------------------------
                                    <Cursor />
                                  </Text>
                                ) : null)}
                            </Text>
                          )}
                        />
const styles = StyleSheet.create({
  root: {flex: 1, paddingLeft: vwNumber(60), paddingRight: vwNumber(60)},
  codeFieldRoot: {marginTop: 30, paddingBottom: 30},
  cell: {
    width: 30,
    height: 30,
    lineHeight: 20,
    fontSize: 17,
    borderWidth: 1,
    backgroundColor: 'white',
    borderColor: '#000',
    textAlign: 'center',
    color: '#000', // ← this line ----------------------
    paddingTop: 5,
  },
  focusCell: {
    borderColor: '#000',
  },
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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