reactnativeshapeimageview-local
v3.0.0
Published
Native Custom Shape Images and Views for React-Native
Downloads
1
Maintainers
Readme
react-native-shape-image-view
Getting started
$ npm install react-native-shape-image-view --save
Mostly automatic installation
$ react-native link react-native-shape-image-view
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-shape-image-view
and addRNShapeImageView.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNShapeImageView.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNShapeImageViewPackage;
to the imports at the top of the file - Add
new RNShapeImageViewPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-shape-image-view' project(':react-native-shape-image-view').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-shape-image-view/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-shape-image-view')
Windows
- In Visual Studio add the
RNShapeImageView.sln
innode_modules/react-native-shape-image-view/windows/RNShapeImageView.sln
folder to their solution, reference from their app. - Open up your
MainPage.cs
app
- Add
using Cl.Json.RNShapeImageView;
to the usings at the top of the file - Add
new RNShapeImageViewPackage()
to theList<IReactPackage>
returned by thePackages
method
Usage
HexagonImage (Android only)
import React, { PropTypes } from 'react';
import { HexagonImage } from 'react-native-shape-image-view';
export const Example = () => (
<HexagonImage
borderWidth={5}
borderColor={'red'}
backgroundColor={'blue'}
src={require('./something.png')} // or { uri: 'https://.....' }
setDefaultSize={true} // set image default width and height, it's works only with local assets
style={{
// some styles here
}}
onLoad={() => console.log('hexagon image loaded')}
/>
);
HexagonView (Android 4.2+, iOS 8.4+)
import React, { PropTypes } from 'react';
import { HexagonView } from 'react-native-shape-image-view';
export const Example = () => (
<HexagonView
isHorizontal={true /* true | false */}
style={{
height: 100,
width: 100,
borderColor: 'red',
borderWidth: 5
/* some styles here */
}}
>
<Image
source={require('./test.jpg')}
style={{ width: 200, height: 200 }}
/>
</HexagonView>
);