0.1.0 • Published 4 years ago

react-primitives-textinput v0.1.0

Weekly downloads
6
License
ISC
Repository
github
Last release
4 years ago

react-primitives-textinput

Cross platform <TextInput> component for React.

Getting Started

Setting up Resolver

You need to setup a resolver to use the correct file for your platform.

You can do this with a custom Webpack or Rollup config.

e.g. for web:

webpack.config.js

const baseConfig = { ... };

module.exports = {
  resolve = {
    ...baseConfig,
    extensions: [
      '.web.js',
      '.web.jsx'
      ...baseConfig.resolve.extensions,
    ]
  };
};

Building a Shared TextInput Component:

import TextInputPrimitive from 'react-primitives-textinput';

const TextInput = (props) => (
  <TextInputPrimitive {...props} />
);
TextInput.defaultProps = {
  style: {
    borderWidth: 1,
    borderColor: 'gray',
  }
};

export default TextInput;