mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 07:14:55 -06:00
update image picker to new version of react-native-image-picker
This commit is contained in:
parent
882644fbe0
commit
38d25a4f5b
1 changed files with 10 additions and 7 deletions
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
import { Text, View, TouchableOpacity, Image } from 'react-native';
|
||||
import { Icon } from 'react-native-material-ui';
|
||||
import uiTheme from '../ui-theme.js';
|
||||
import ReactNativeImagePicker from 'react-native-image-picker';
|
||||
import * as ReactNativeImagePicker from 'react-native-image-picker';
|
||||
import { type List } from 'immutable';
|
||||
|
||||
const { palette: { accentColor } } = uiTheme;
|
||||
|
|
@ -15,21 +15,24 @@ const openImagePicker = onCreateNew => () =>
|
|||
}
|
||||
});
|
||||
|
||||
export const ImageThumb = ({ uri, onPress }: { uri?: string, onPress: () => void }) =>
|
||||
export const ImageThumb = ({ uri, onPress }: { uri?: string, onPress: () => void }) => (
|
||||
<TouchableOpacity onPress={onPress}>
|
||||
<Image source={{ uri }} style={{ height: 35, width: 35, margin: 5 }} />
|
||||
</TouchableOpacity>;
|
||||
</TouchableOpacity>
|
||||
);
|
||||
|
||||
export const ImagePicker = ({ children, onCreateNew }: { children?: List<any>, onCreateNew: Function }) =>
|
||||
export const ImagePicker = ({ children, onCreateNew }: { children?: List<any>, onCreateNew: Function }) => (
|
||||
<View style={{ flexDirection: 'row', marginTop: 10 }}>
|
||||
<TouchableOpacity onPress={openImagePicker(onCreateNew)}>
|
||||
<View style={{ flexDirection: 'row' }}>
|
||||
<Icon name="insert-photo" size={35} color={accentColor} style={{ margin: 5 }} />
|
||||
{(!children || !children.size) &&
|
||||
{(!children || !children.size) && (
|
||||
<View style={{ flexDirection: 'column', justifyContent: 'center' }}>
|
||||
<Text style={{ fontSize: 16 }}>Add Images</Text>
|
||||
</View>}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
{children}
|
||||
</View>;
|
||||
</View>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue