Wednesday, 28 August 2019

React Native TextInput background color looks double layered when it's set to color with transparence

I have a TextInput with backgroundColor of 'rgba(255,255,255,0.16)' as below:

example on snack: https://snack.expo.io/rkEhXn6Nr

import * as React from 'react';
import { TextInput, View, StyleSheet } from 'react-native';

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <TextInput
          style={styles.paragraph}
          value={"bleep bleep bleep bleep"}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: 'green',
  },
  paragraph: {
    padding: 24,
    margin: 24,
    fontSize: 24,
    textAlign: 'center',
    backgroundColor: 'rgba(255,255,255,0.16)',
  },
});

enter image description here

It looks like as if there's a view (THERE ISN'T) with that background color and a text element also with that background color wrapped inside. How can I only have the "view" to have that background color? It looks fine on android:

enter image description here



from React Native TextInput background color looks double layered when it's set to color with transparence

No comments:

Post a Comment