A selectable and pressable text component for React Native.
demo.mov
yarn add @dumpster-fire-code/react-native-pressable-selectable-text
npm install --save @dumpster-fire-code/react-native-pressable-selectable-text
import { SelectableText } from '@dumpster-fire-code/react-native-pressable-selectable-text';
function MyComponent {
return (
<SelectableText onPress={() => alert('pressed')}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</SelectableText>
);
}
The SelectableText
component is a thin wrapper around React Native's TextInput
and accepts all the same properties, other than value
– which is instead expected as children
.
After installing Node and Yarn, run yarn install
from the project root to install package dependencies.
To start the example Expo app:
cd example
yarn start
To have Watchman) watch for changes to the package, then synchronize the example app using Yalc, run yarn watch
from the project root.