0.0.2 • Published 6 years ago

rn-text-wrap v0.0.2

Weekly downloads
10
License
-
Repository
github
Last release
6 years ago

rn-text-wrap

React Native component that wraps some frequently used features of a text view into one.

Installation

npm install --save rn-text-wrap

Usage example

import { TextWrap as Text } from 'rn-text-wrap'
<Text>Use same way as RN Text</Text>

Touchable

Before

<TouchableOpacity onPress={onPressHandler}>
	<Text>Press me</Text>
</TouchableOpacity>

Now

<Text onPress={onPressHandler}>Press me</Text>

Leading/Trailing parts

Before

<View style={{
	flexDirection: 'row' // or 'column'
}}>
	<TouchableOpacity onPress={onPressLeadingImage}>
		<Image 
			source={leadingImageSource} 
			style={leadingImageStyle} />
	</TouchableOpacity>
	<Text>Text goes here</Text>
	<TouchableOpacity onPress={onPressTrailingImage}>
		<Image 
			source={trailingImageSource} 
			style={trailingImageStyle}/>
	</TouchableOpacity>
</View>

Now

<Text left={{
		onPress: onPressLeadingImage
		icon: leadingImageSource,
		style: leadingImageStyle,
		render: returnAnyComponent	// giving this will ignore above two
	}}	// or top={...}
	right={{
		onPress: onPressTrailingImage
		icon: trailingImageSource,
		style: trailingImageStyle,
		render: returnAnyComponent	// giving this will ignore above two
	}}	// or bottom={...}
>Text goes here</Text>

This library was tested with:

"react": "16.0.0-alpha.12",
"react-native": "0.46.4",
		```