docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
sequencelengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
<mask> import React, { memo, forwardRef, useRef } from 'react'; <mask> import { Text as NativeText } from 'react-native'; <mask> import { useTheme } from '../../../hooks'; <mask> import { usePropsResolution } from '../../../hooks/useThemeProps'; <mask> import type { ITextProps } from './types'; <mask> import { useHover } from '@react-native-aria/interactions'; <mask> import { mergeRefs } from '../../../utils/mergeRefs'; <mask> import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps'; </s> fix: broken uis and component theme integrations </s> remove import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps'; </s> add </s> remove type IUseResolvedFontFamily = { fontFamily: string; fontStyle: string; fontWeight: string | number; }; // Android doesn't support fontWeight or fontStyle properties. So, we pass fontFamily instead. function useResolvedFontFamily(props: IUseResolvedFontFamily) { const { fontFamily, fontStyle, fontWeight } = props; const { fontConfig, fontWeights, fonts } = useTheme(); const fontToken = fonts[fontFamily]; if (fontConfig && fontConfig[fontToken]) { // fontWeights are also specified using "400" const parsedFontWeight = parseInt(fontWeight as any); let fontWeightNumber = Number.isNaN(parsedFontWeight) ? fontWeights[fontWeight] : fontWeight; let fontVariants = fontConfig[fontToken][fontWeightNumber]; if (typeof fontVariants === 'object') { if (fontVariants[fontStyle]) return fontVariants[fontStyle]; } else { return fontVariants; } } } </s> add import { useResolvedFontFamily } from '../../../hooks/useResolvedFontFamily'; import { Text as NativeText } from 'react-native'; import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps'; </s> remove const { resolvedProps } = usePropsResolution('InputLeftAddon', props); </s> add const resolvedProps = usePropsResolution('InputLeftAddon', props); </s> remove const { resolvedProps } = usePropsResolution('InputRightAddon', props); </s> add const resolvedProps = usePropsResolution('InputRightAddon', props); </s> remove lineHeight: 6, // Todo: Move to _web inside size so that sm and xs don't have this much height </s> add lineHeight: 'lg', // Todo: Move to _web inside size so that sm and xs don't have this much height
[ "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d1e65b3a29701927408720f3afd2977ebc7f4733
src/components/primitives/Text/index.tsx
<mask> import { usePropsResolution } from '../../../hooks/useThemeProps'; <mask> import type { ITextProps } from './types'; <mask> import { useHover } from '@react-native-aria/interactions'; <mask> import { mergeRefs } from '../../../utils/mergeRefs'; <mask> import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps'; <mask> import { makeStyledComponent } from '../../../utils/styled'; <mask> <mask> type IUseResolvedFontFamily = { <mask> fontFamily: string; <mask> fontStyle: string; </s> fix: broken uis and component theme integrations </s> remove import { Text as NativeText } from 'react-native'; import { useTheme } from '../../../hooks'; </s> add </s> remove type IUseResolvedFontFamily = { fontFamily: string; fontStyle: string; fontWeight: string | number; }; // Android doesn't support fontWeight or fontStyle properties. So, we pass fontFamily instead. function useResolvedFontFamily(props: IUseResolvedFontFamily) { const { fontFamily, fontStyle, fontWeight } = props; const { fontConfig, fontWeights, fonts } = useTheme(); const fontToken = fonts[fontFamily]; if (fontConfig && fontConfig[fontToken]) { // fontWeights are also specified using "400" const parsedFontWeight = parseInt(fontWeight as any); let fontWeightNumber = Number.isNaN(parsedFontWeight) ? fontWeights[fontWeight] : fontWeight; let fontVariants = fontConfig[fontToken][fontWeightNumber]; if (typeof fontVariants === 'object') { if (fontVariants[fontStyle]) return fontVariants[fontStyle]; } else { return fontVariants; } } } </s> add import { useResolvedFontFamily } from '../../../hooks/useResolvedFontFamily'; import { Text as NativeText } from 'react-native'; import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps'; </s> remove const { resolvedProps } = usePropsResolution('InputLeftAddon', props); </s> add const resolvedProps = usePropsResolution('InputLeftAddon', props); </s> remove const { resolvedProps } = usePropsResolution('InputRightAddon', props); </s> add const resolvedProps = usePropsResolution('InputRightAddon', props); </s> remove lineHeight: 6, // Todo: Move to _web inside size so that sm and xs don't have this much height </s> add lineHeight: 'lg', // Todo: Move to _web inside size so that sm and xs don't have this much height
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d1e65b3a29701927408720f3afd2977ebc7f4733
src/components/primitives/Text/index.tsx
import { useResolvedFontFamily } from '../../../hooks/useResolvedFontFamily'; import { Text as NativeText } from 'react-native'; import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps';
<mask> import { useHover } from '@react-native-aria/interactions'; <mask> import { mergeRefs } from '../../../utils/mergeRefs'; <mask> import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps'; <mask> import { makeStyledComponent } from '../../../utils/styled'; <mask> <mask> type IUseResolvedFontFamily = { <mask> fontFamily: string; <mask> fontStyle: string; <mask> fontWeight: string | number; <mask> }; <mask> <mask> // Android doesn't support fontWeight or fontStyle properties. So, we pass fontFamily instead. <mask> function useResolvedFontFamily(props: IUseResolvedFontFamily) { <mask> const { fontFamily, fontStyle, fontWeight } = props; <mask> <mask> const { fontConfig, fontWeights, fonts } = useTheme(); <mask> const fontToken = fonts[fontFamily]; <mask> <mask> if (fontConfig && fontConfig[fontToken]) { <mask> // fontWeights are also specified using "400" <mask> const parsedFontWeight = parseInt(fontWeight as any); <mask> let fontWeightNumber = Number.isNaN(parsedFontWeight) <mask> ? fontWeights[fontWeight] <mask> : fontWeight; <mask> let fontVariants = fontConfig[fontToken][fontWeightNumber]; <mask> if (typeof fontVariants === 'object') { <mask> if (fontVariants[fontStyle]) return fontVariants[fontStyle]; <mask> } else { <mask> return fontVariants; <mask> } <mask> } <mask> } <mask> <mask> const StyledText = makeStyledComponent(NativeText); <mask> <mask> const Text = ({ children, ...props }: ITextProps, ref: any) => { <mask> const { </s> fix: broken uis and component theme integrations </s> remove import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps'; </s> add </s> remove const { resolvedProps } = usePropsResolution('InputLeftAddon', props); </s> add const resolvedProps = usePropsResolution('InputLeftAddon', props); </s> remove import { Text as NativeText } from 'react-native'; import { useTheme } from '../../../hooks'; </s> add </s> remove const { resolvedProps } = usePropsResolution('InputRightAddon', props); </s> add const resolvedProps = usePropsResolution('InputRightAddon', props); </s> remove lineHeight: 6, // Todo: Move to _web inside size so that sm and xs don't have this much height </s> add lineHeight: 'lg', // Todo: Move to _web inside size so that sm and xs don't have this much height
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d1e65b3a29701927408720f3afd2977ebc7f4733
src/components/primitives/Text/index.tsx
lineHeight: 'lg', // Todo: Move to _web inside size so that sm and xs don't have this much height
<mask> }, <mask> }, <mask> _web: { <mask> outlineWidth: 0, <mask> lineHeight: 6, // Todo: Move to _web inside size so that sm and xs don't have this much height <mask> }, <mask> }; <mask> }; <mask> <mask> function roundedStyle() { </s> fix: broken uis and component theme integrations </s> remove type IUseResolvedFontFamily = { fontFamily: string; fontStyle: string; fontWeight: string | number; }; // Android doesn't support fontWeight or fontStyle properties. So, we pass fontFamily instead. function useResolvedFontFamily(props: IUseResolvedFontFamily) { const { fontFamily, fontStyle, fontWeight } = props; const { fontConfig, fontWeights, fonts } = useTheme(); const fontToken = fonts[fontFamily]; if (fontConfig && fontConfig[fontToken]) { // fontWeights are also specified using "400" const parsedFontWeight = parseInt(fontWeight as any); let fontWeightNumber = Number.isNaN(parsedFontWeight) ? fontWeights[fontWeight] : fontWeight; let fontVariants = fontConfig[fontToken][fontWeightNumber]; if (typeof fontVariants === 'object') { if (fontVariants[fontStyle]) return fontVariants[fontStyle]; } else { return fontVariants; } } } </s> add import { useResolvedFontFamily } from '../../../hooks/useResolvedFontFamily'; import { Text as NativeText } from 'react-native'; import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps'; </s> remove import { Text as NativeText } from 'react-native'; import { useTheme } from '../../../hooks'; </s> add </s> remove import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps'; </s> add </s> remove const { resolvedProps } = usePropsResolution('InputLeftAddon', props); </s> add const resolvedProps = usePropsResolution('InputLeftAddon', props); </s> remove const { resolvedProps } = usePropsResolution('InputRightAddon', props); </s> add const resolvedProps = usePropsResolution('InputRightAddon', props);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d1e65b3a29701927408720f3afd2977ebc7f4733
src/theme/components/input.ts
//Basic
<mask> // Components <mask> //Baisc <mask> export * from './components/basic/ScrollView'; <mask> export * from './components/basic/FlatList'; <mask> export * from './components/basic/SectionList'; <mask> export * from './components/basic/StatusBar'; <mask> export * from './components/basic/KeyboardAvoidingView'; </s> fix: resolved a select bug and added disabled </s> remove <option ref={ref} value={value}> </s> add <option ref={ref} value={value} disabled={isDisabled}> </s> remove value={value} </s> add value={ selectedItem === null ? '__NativebasePlaceholder__' : value }
[ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d247da9311b5149410b66fadc09d04a722627015
example/storybook/stories/index.ts
isDisabled={isDisabled}
<mask> {...nonLayoutProps} <mask> {...borderProps} <mask> /> <mask> ); <mask> <mask> const handleClose = () => setIsOpen(false); </s> fix: resolved a select bug and added disabled </s> remove <option ref={ref} value={value}> </s> add <option ref={ref} value={value} disabled={isDisabled}> </s> remove value={value} </s> add value={ selectedItem === null ? '__NativebasePlaceholder__' : value } </s> remove //Baisc </s> add //Basic
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d247da9311b5149410b66fadc09d04a722627015
src/components/primitives/Select/Select.tsx
value={ selectedItem === null ? '__NativebasePlaceholder__' : value }
<mask> style={unstyledSelecWebtStyles} <mask> onChange={(e) => { <mask> setValue(e.target.value); <mask> }} <mask> value={value} <mask> aria-label={placeholder} <mask> > <mask> {children} <mask> </select> <mask> </Box> </s> fix: resolved a select bug and added disabled </s> remove <option ref={ref} value={value}> </s> add <option ref={ref} value={value} disabled={isDisabled}> </s> remove //Baisc </s> add //Basic
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d247da9311b5149410b66fadc09d04a722627015
src/components/primitives/Select/Select.tsx
<option disabled value="__NativebasePlaceholder__"> {placeholder} </option>
<mask> } <mask> aria-label={placeholder} <mask> > <mask> {children} <mask> </select> <mask> </Box> <mask> {commonInput} <mask> </> </s> fix: resolved a select bug and added disabled </s> remove value={value} </s> add value={ selectedItem === null ? '__NativebasePlaceholder__' : value } </s> remove <option ref={ref} value={value}> </s> add <option ref={ref} value={value} disabled={isDisabled}> </s> remove //Baisc </s> add //Basic
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d247da9311b5149410b66fadc09d04a722627015
src/components/primitives/Select/Select.tsx
<option ref={ref} value={value} disabled={isDisabled}>
<mask> </Actionsheet.Item> <mask> ); <mask> } else { <mask> return ( <mask> <option ref={ref} value={value}> <mask> {label} <mask> </option> <mask> ); <mask> } <mask> }; </s> fix: resolved a select bug and added disabled </s> remove value={value} </s> add value={ selectedItem === null ? '__NativebasePlaceholder__' : value } </s> remove //Baisc </s> add //Basic
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d247da9311b5149410b66fadc09d04a722627015
src/components/primitives/Select/SelectItem.tsx
expect(spinner.props.style).toEqual(undefined);
<mask> maxWidth: '100%', <mask> width: defaultTheme.space['20'], <mask> }); <mask> <mask> expect(spinner.props.style).toEqual({}); <mask> }); <mask> <mask> it('resolves base style and variants, sizes and default props with props', () => { <mask> const newTheme = extendTheme({ <mask> components: { </s> fix: support string numbers for backward compatibility </s> remove styleFromProps = { ...styleFromProps, [key]: value }; </s> add styleFromProps = { ...styleFromProps, [key]: convertStringNumberToNumber(key, value), }; </s> remove val = parseInt(val, 10); </s> add val = parseFloat(val);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d25a80547b0cd38213780ca896aa4832afa168c1
src/hooks/useThemeProps/usePropsResolution.test.tsx
// For backward compatibility with 3.0 of props like string numbers `<Box mt={"39"} />` const convertStringNumberToNumber = (key: string, value: string) => { if ( typeof value === 'string' && key !== 'fontWeight' && value && !isNaN(Number(value)) ) { return parseFloat(value); } return value; };
<mask> ...background, <mask> ...extraProps, <mask> }; <mask> <mask> export const getStyleAndFilteredProps = ({ <mask> style, <mask> theme, <mask> debug, </s> fix: support string numbers for backward compatibility </s> remove styleFromProps = { ...styleFromProps, [key]: value }; </s> add styleFromProps = { ...styleFromProps, [key]: convertStringNumberToNumber(key, value), }; </s> remove expect(spinner.props.style).toEqual({}); </s> add expect(spinner.props.style).toEqual(undefined); </s> remove val = parseInt(val, 10); </s> add val = parseFloat(val);
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d25a80547b0cd38213780ca896aa4832afa168c1
src/theme/styled-system.ts
styleFromProps = { ...styleFromProps, [key]: convertStringNumberToNumber(key, value), };
<mask> ); <mask> <mask> const config = propConfig[key as keyof typeof propConfig]; <mask> if (config === true) { <mask> styleFromProps = { ...styleFromProps, [key]: value }; <mask> } else if (config) { <mask> //@ts-ignore <mask> const { property, scale, properties, transformer } = config; <mask> let val = value; <mask> if (transformer) { </s> fix: support string numbers for backward compatibility </s> remove val = parseInt(val, 10); </s> add val = parseFloat(val); </s> remove expect(spinner.props.style).toEqual({}); </s> add expect(spinner.props.style).toEqual(undefined);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d25a80547b0cd38213780ca896aa4832afa168c1
src/theme/styled-system.ts
val = parseFloat(val);
<mask> } else { <mask> val = get(theme[scale], value, value); <mask> } <mask> if (typeof val === 'string' && val.endsWith('px')) { <mask> val = parseInt(val, 10); <mask> } <mask> if (properties) { <mask> //@ts-ignore <mask> properties.forEach((property) => { <mask> styleFromProps = { </s> fix: support string numbers for backward compatibility </s> remove styleFromProps = { ...styleFromProps, [key]: value }; </s> add styleFromProps = { ...styleFromProps, [key]: convertStringNumberToNumber(key, value), }; </s> remove expect(spinner.props.style).toEqual({}); </s> add expect(spinner.props.style).toEqual(undefined);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d25a80547b0cd38213780ca896aa4832afa168c1
src/theme/styled-system.ts
val = convertStringNumberToNumber(key, val);
<mask> val = parseFloat(val); <mask> } <mask> if (properties) { <mask> //@ts-ignore <mask> properties.forEach((property) => { <mask> styleFromProps = { </s> fix: support string numbers for backward compatibility </s> remove val = parseInt(val, 10); </s> add val = parseFloat(val); </s> remove styleFromProps = { ...styleFromProps, [key]: value }; </s> add styleFromProps = { ...styleFromProps, [key]: convertStringNumberToNumber(key, value), }; </s> remove expect(spinner.props.style).toEqual({}); </s> add expect(spinner.props.style).toEqual(undefined);
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d25a80547b0cd38213780ca896aa4832afa168c1
src/theme/styled-system.ts
const [show, setShow] = React.useState(false);
<mask> import { MaterialIcons } from '@expo/vector-icons'; <mask> <mask> export const Example = () => { <mask> return ( <mask> <Stack space={4} w="100%" alignItems="center"> <mask> <Input <mask> w={{ base: '75%', md: '25%' }} </s> added variable to show/hide password </s> remove as={<MaterialIcons name="visibility-off" />} </s> add as={<MaterialIcons name={show ? 'visibility' : 'visibility-off'} />}
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d30196a988cb4d98581149127398527088afb547
example/storybook/stories/components/primitives/Input/Elements.tsx
type={show ? 'text' : 'password'}
<mask> <Input <mask> w={{ base: '75%', md: '25%' }} <mask> InputRightElement={ <mask> <Icon <mask> as={<MaterialIcons name={show ? 'visibility' : 'visibility-off'} />} <mask> size={5} <mask> mr="2" <mask> color="muted.400" </s> added variable to show/hide password </s> remove as={<MaterialIcons name="visibility-off" />} </s> add as={<MaterialIcons name={show ? 'visibility' : 'visibility-off'} />}
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d30196a988cb4d98581149127398527088afb547
example/storybook/stories/components/primitives/Input/Elements.tsx
as={<MaterialIcons name={show ? 'visibility' : 'visibility-off'} />}
<mask> <Input <mask> w={{ base: '75%', md: '25%' }} <mask> InputRightElement={ <mask> <Icon <mask> as={<MaterialIcons name="visibility-off" />} <mask> size={5} <mask> mr="2" <mask> color="muted.400" <mask> /> <mask> } </s> added variable to show/hide password
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d30196a988cb4d98581149127398527088afb547
example/storybook/stories/components/primitives/Input/Elements.tsx
inputProps = inp.props; var clonedInp = React.cloneElement( inp, { ...this.inputProps, key: 'inp', editable: this.props.disabled ? false : undefined } )
<mask> } <mask> }); <mask> <mask> if(inp) { <mask> inputProps = computeProps(this.props, inp.props); <mask> } <mask> else { <mask> inputProps = this.props; <mask> } <mask> <mask> if(Array.isArray(this.props.children)) { <mask> <mask> if(this.props.iconRight) { </s> input group updated with ref </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d3734dea02aec07a4fbbf696db6059171f10cc1f
Components/Widgets/InputGroup.js
if(clonedInp) { newChildren.push(clonedInp); }
<mask> <mask> if(Array.isArray(this.props.children)) { <mask> <mask> if(this.props.iconRight) { <mask> newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); <mask> newChildren.push(React.cloneElement(iconElement[0],this.getIconProps(iconElement[0]))); <mask> } <mask> else if(buttonElement.length>0) { <mask> newChildren.push(React.cloneElement( <mask> iconElement[0], </s> input group updated with ref </s> remove inputProps = computeProps(this.props, inp.props); } else { inputProps = this.props; </s> add inputProps = inp.props; var clonedInp = React.cloneElement( inp, { ...this.inputProps, key: 'inp', editable: this.props.disabled ? false : undefined } ) </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d3734dea02aec07a4fbbf696db6059171f10cc1f
Components/Widgets/InputGroup.js
if(clonedInp) { newChildren.push(clonedInp); }
<mask> ...this.getIconProps(iconElement[0]), <mask> key: 'icon0' <mask> } <mask> )); <mask> newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); <mask> newChildren.push(React.cloneElement( <mask> buttonElement[0], <mask> { <mask> ...this.getButtonProps(buttonElement[0]), <mask> key: 'button1' </s> input group updated with ref </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove inputProps = computeProps(this.props, inp.props); } else { inputProps = this.props; </s> add inputProps = inp.props; var clonedInp = React.cloneElement( inp, { ...this.inputProps, key: 'inp', editable: this.props.disabled ? false : undefined } )
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d3734dea02aec07a4fbbf696db6059171f10cc1f
Components/Widgets/InputGroup.js
if(clonedInp) { newChildren.push(clonedInp); }
<mask> ...this.getIconProps(iconElement[0]), <mask> key: 'icon0' <mask> } <mask> )); <mask> newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); <mask> newChildren.push(React.cloneElement( <mask> iconElement[1], <mask> { <mask> ...this.getIconProps(iconElement[1]), <mask> key: 'icon1' </s> input group updated with ref </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove inputProps = computeProps(this.props, inp.props); } else { inputProps = this.props; </s> add inputProps = inp.props; var clonedInp = React.cloneElement( inp, { ...this.inputProps, key: 'inp', editable: this.props.disabled ? false : undefined } )
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d3734dea02aec07a4fbbf696db6059171f10cc1f
Components/Widgets/InputGroup.js
if(clonedInp) { newChildren.push(clonedInp); }
<mask> } <mask> )); <mask> } else { <mask> newChildren.push(React.cloneElement(iconElement[0], this.getIconProps(iconElement[0]))); <mask> newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); <mask> } <mask> } <mask> } <mask> <mask> else { </s> input group updated with ref </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove inputProps = computeProps(this.props, inp.props); } else { inputProps = this.props; </s> add inputProps = inp.props; var clonedInp = React.cloneElement( inp, { ...this.inputProps, key: 'inp', editable: this.props.disabled ? false : undefined } )
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d3734dea02aec07a4fbbf696db6059171f10cc1f
Components/Widgets/InputGroup.js
if(clonedInp) { newChildren.push(clonedInp); }
<mask> } <mask> } <mask> <mask> else { <mask> newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); <mask> } <mask> <mask> return newChildren; <mask> } <mask> </s> input group updated with ref </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove newChildren.push(<Input editable={this.props.disabled ? false : undefined} key='inp' {...inputProps} />); </s> add if(clonedInp) { newChildren.push(clonedInp); } </s> remove inputProps = computeProps(this.props, inp.props); } else { inputProps = this.props; </s> add inputProps = inp.props; var clonedInp = React.cloneElement( inp, { ...this.inputProps, key: 'inp', editable: this.props.disabled ? false : undefined } )
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d3734dea02aec07a4fbbf696db6059171f10cc1f
Components/Widgets/InputGroup.js
<mask> <<<<<<< HEAD <mask> Object.defineProperty(exports,"__esModule",{value:true});exports.Item=undefined;var _jsxFileName="src/basic/Item.js";var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _react=require("react");var _react2=_interopRequireDefault(_react); <mask> var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_propTypes); <mask> var _reactNative=require("react-native"); <mask> <mask> </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove ======= Object.defineProperty(exports,"__esModule",{value:true});exports.Item=undefined;var _jsxFileName="src/basic/Item.js";var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _react=require("react");var _react2=_interopRequireDefault(_react);var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_propTypes);var _reactNative=require("react-native");var _Input=require("./Input");var _Label=require("./Label");var _Icon=require("./Icon");var _nativeBaseShoutemTheme=require("native-base-shoutem-theme");var _platform=require("../theme/variables/platform");var _platform2=_interopRequireDefault(_platform);var _computeProps=require("../utils/computeProps");var _computeProps2=_interopRequireDefault(_computeProps);var _mapPropsToStyleNames=require("../utils/mapPropsToStyleNames");var _mapPropsToStyleNames2=_interopRequireDefault(_mapPropsToStyleNames);var _lodash=require("lodash");var _lodash2=_interopRequireDefault(_lodash);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var Item=function(_Component){_inherits(Item,_Component);function Item(props){_classCallCheck(this,Item);var _this=_possibleConstructorReturn(this,(Item.__proto__||Object.getPrototypeOf(Item)).call(this,props));_this.state={text:"",topAnim:new _reactNative.Animated.Value(18),opacAnim:new _reactNative.Animated.Value(1)};return _this;}_createClass(Item,[{key:"componentDidMount",value:function componentDidMount(){if(this.props.floatingLabel){if(this.inputProps&&this.inputProps.value){this.setState({isFocused:true});this.floatUp(-16);}if(this.inputProps&&this.inputProps.getRef)this.inputProps.getRef(this._inputRef);}}},{key:"componentWillReceiveProps",value:function componentWillReceiveProps(nextProps){var _this2=this;var childrenArray=_react2.default.Children.toArray(nextProps.children);var inputProps={};_lodash2.default.remove(childrenArray,function(item){if(item.type.displayName==="Styled(Input)"){inputProps=item.props;_this2.inputProps=item.props;return item;}});if(this.props.floatingLabel){if(this.inputProps&&this.inputProps.value){this.setState({isFocused:true});this.floatUp(-16);}if(this.inputProps&&this.inputProps.getRef)this.inputProps.getRef(this._inputRef);}}},{key:"floatBack",value:function floatBack(){_reactNative.Animated.timing(this.state.topAnim,{toValue:18,duration:150}).start();_reactNative.Animated.timing(this.state.opacAnim,{toValue:1,duration:150}).start();}},{key:"floatUp",value:function floatUp(e){_reactNative.Animated.timing(this.state.topAnim,{toValue:e||-22,duration:150}).start();_reactNative.Animated.timing(this.state.opacAnim,{toValue:0.7,duration:150}).start();}},{key:"renderLabel",value:function renderLabel(label,labelProps){var newLabel=[];var labelStyle=_reactNative.StyleSheet.flatten({fontSize:15,lineHeight:30},labelProps.style);if(this.props.floatingLabel){if(this.state.isFocused){newLabel.push(_react2.default.createElement(_Label.Label,_extends({},labelProps,{key:"newFLabel",float:true,style:labelStyle})));this.floatUp(-16);}else{newLabel.push(label);this.floatBack();}}else{newLabel.push(_react2.default.createElement(_Label.Label,_extends({},labelProps,{key:"newLabel"})));}return newLabel;}},{key:"renderChildren",value:function renderChildren(){var _this3=this;var newChildren=[];var childrenArray=_react2.default.Children.toArray(this.props.children);var label=[];var labelProps={};label=_lodash2.default.remove(childrenArray,function(item){if(item.type===_Label.Label){labelProps=item.props;return item;}});var input=[];var inputProps={};input=_lodash2.default.remove(childrenArray,function(item){if(item.type===_Input.Input){inputProps=item.props;_this3.inputProps=item.props;return item;}});var icon=[];var iconProps={};icon=_lodash2.default.remove(childrenArray,function(item){if(item.type===_Icon.Icon){iconProps=item.props;return item;}});if(this.props.floatingLabel&&icon.length){var isIcon=false;for(var i=0;i<this.props.children.length;i++){if(this.props.children[i].props.name&&this.props.children[i].type.displayName!=="Styled(Input)"){isIcon=true;newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:[i]},this.props.children[i].props,{__source:{fileName:_jsxFileName,lineNumber:150}})));}if(this.props.children[i].props.children){newChildren.push(_react2.default.createElement(_reactNative.Animated.View,{key:"float",style:{position:"absolute",left:this.props.last&&isIcon?40:this.props.last?15:isIcon?26:0,right:0,top:this.state.topAnim,opacity:this.state.opacAnim,paddingTop:_reactNative.Platform.OS==="ios"?undefined:undefined,paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:155}},_react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:174}}),this.renderLabel(label,labelProps))));newChildren.push(_react2.default.createElement(_Input.Input,_extends({ref:function ref(c){return _this3._inputRef=c;},key:"l2"},inputProps,{onFocus:function onFocus(){_this3.setState({isFocused:true});inputProps.onFocus&&inputProps.onFocus();},onBlur:function onBlur(){inputProps.value?_this3.setState({isFocused:true}):!_this3.state.text.length&&_this3.setState({isFocused:false});inputProps.onBlur&&inputProps.onBlur();},onChangeText:function onChangeText(text){_this3.setState({text:text});inputProps.onChangeText&&inputProps.onChangeText(text);},__source:{fileName:_jsxFileName,lineNumber:180}})));}}}else if(this.props.floatingLabel){newChildren.push(_react2.default.createElement(_reactNative.Animated.View,{key:"float",style:{position:"absolute",left:this.props.last?15:0,right:0,top:this.state.topAnim,opacity:this.state.opacAnim,paddingTop:_reactNative.Platform.OS==="ios"?undefined:undefined,paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:207}},_react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:219}}),this.renderLabel(label,labelProps))));newChildren.push(_react2.default.createElement(_Input.Input,_extends({ref:function ref(c){return _this3._inputRef=c;},value:this.state.text,key:"l2"},inputProps,{onFocus:function onFocus(){_this3.setState({isFocused:true});inputProps.onFocus&&inputProps.onFocus();},onBlur:function onBlur(){inputProps.value?_this3.setState({isFocused:true}):!_this3.state.text.length&&_this3.setState({isFocused:false});inputProps.onBlur&&inputProps.onBlur();},onChangeText:function onChangeText(text){_this3.setState({text:text});inputProps.onChangeText&&inputProps.onChangeText(text);},__source:{fileName:_jsxFileName,lineNumber:223}})));}else if(this.props.stackedLabel&&icon.length){newChildren.push(_react2.default.createElement(_reactNative.View,{key:"s",style:{flexDirection:"row",flex:1,width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:248}},_react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:256}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:257}},_react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:258}})),_react2.default.createElement(_Input.Input,_extends({key:"s3"},inputProps,{style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:259}})))));}else{return this.props.children;}return newChildren;}},{key:"getInitialStyle",value:function getInitialStyle(){return{roundedInputGroup:{borderWidth:this.props.rounded?_platform2.default.borderWidth*2:undefined,borderRadius:this.props.rounded?_platform2.default.inputGroupRoundedBorderRadius:undefined}};}},{key:"prepareRootProps",value:function prepareRootProps(){var defaultProps={style:this.getInitialStyle().roundedInputGroup};return(0,_computeProps2.default)(this.props,defaultProps);}},{key:"render",value:function render(){var _this4=this;return _react2.default.createElement(_reactNative.TouchableOpacity,_extends({ref:function ref(c){return _this4._root=c;}},this.prepareRootProps(),{activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:292}}),this.renderChildren());}}]);return Item;}(_react.Component);var childrenType=function childrenType(props,propName,component){var error=void 0;var prop=props[propName];if(!props.children.length){error=new Error(component+" should have both Label and Input components");}else if(props.children[0].type.displayName!=="Styled(Label)"||props.children[1].type.displayName!=="Styled(Input)"){error=new Error(component+" should have Label and Input components only");}return error;};Item.propTypes=_extends({},_reactNative.TouchableOpacity.propTypes,{style:_propTypes2.default.oneOfType([_propTypes2.default.object,_propTypes2.default.number,_propTypes2.default.array]),inlineLabel:_propTypes2.default.bool,floatingLabel:_propTypes2.default.bool,stackedLabel:_propTypes2.default.bool,fixedLabel:_propTypes2.default.bool,success:_propTypes2.default.bool,error:_propTypes2.default.bool});var StyledItem=(0,_nativeBaseShoutemTheme.connectStyle)("NativeBase.Item",{},_mapPropsToStyleNames2.default)(Item);exports.Item=StyledItem; >>>>>>> master </s> add </s> remove return true; </s> add </s> remove var hasIcon=icon&&icon.length; if(hasIcon){ icon.forEach(function(iconItem){ newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:iconItem.key},iconItem.props,{__source:{fileName:_jsxFileName,lineNumber:179}}))); }); } </s> add </s> remove <<<<<<< HEAD {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD,CAHD,IAGO;AACL,KAAKD,QAAL,CAAc,CAAEJ,UAAW,KAAb,CAAd;AACD;AACD,GAAI,KAAKE,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OA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vB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACAsE,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBAhG,KAAKmG,SAAL;AACKC,8BAAiBD,SADtB;AAEE1D,MAAO4D,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} ======= {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B,2CACA,qC,mDACA,yCAOA,8BACA,8BACA,4BAEA,iEACA,qD,iDACA,mD,yDACA,mE,yEACA,8B,i7BAEMA,K,iDACJ,cAAYC,KAAZ,CAAmB,8HACXA,KADW,GAEjB,MAAKC,KAAL,CAAa,CACXC,KAAM,EADK,CAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE,CAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC,CAAb,CAFiB,aAOlB,C,8EACmB,CAClB,GAAI,KAAKL,KAAL,CAAWO,aAAf,CAA8B,CAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C,CAC5C,KAAKC,QAAL,CAAc,CAAEC,UAAW,IAAb,CAAd,EACA,KAAKC,OAAL,CAAa,CAAC,EAAd,EACD,CACD,GAAI,KAAKJ,UAAL,EAAmB,KAAKA,UAAL,CAAgBK,MAAvC,CACE,KAAKL,UAAL,CAAgBK,MAAhB,CAAuB,KAAKC,SAA5B,EACH,CACF,C,4EACyBC,S,CAAW,iBACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB,CACA,GAAIZ,YAAa,EAAjB,CACAa,iBAAEC,MAAF,CAASN,aAAT,CAAwB,cAAQ,CAC9B,GAAIO,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C,CAC7CjB,WAAae,KAAKvB,KAAlB,CACA,OAAKQ,UAAL,CAAkBe,KAAKvB,KAAvB,CACA,MAAOuB,KAAP,CACD,CACF,CAND,EAOA,GAAI,KAAKvB,KAAL,CAAWO,aAAf,CAA8B,CAC5B,GAAI,KAAKC,UAAL,EAAmB,K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UE,MADe,CAEzBF,oBAAUG,MAFe,CAGzBH,oBAAUI,KAHe,CAApB,CAFT,CAOEC,YAAaL,oBAAUM,IAPzB,CAQEhG,cAAe0F,oBAAUM,IAR3B,CASE/B,aAAcyB,oBAAUM,IAT1B,CAUEC,WAAYP,oBAAUM,IAVxB,CAWEE,QAASR,oBAAUM,IAXrB,CAYEX,MAAOK,oBAAUM,IAZnB,GAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} >>>>>>> master </s> add {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD;AACD,GAAI,KAAKH,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,C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,MAAMkG,QAAN,CAAb;AACA,GAAI,CAAClG,MAAMoB,QAAN,CAAe8B,MAApB,CAA4B;AAC1BkD,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD,CAJD,IAIO;AACLnG,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACA2E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]}
[ "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
<mask> if(this.props.floatingLabel){ <mask> if(this.inputProps&&this.inputProps.value){ <mask> this.setState({isFocused:true}); <mask> this.floatUp(-16); <mask> }else{ <mask> this.setState({isFocused:false}); <mask> } <mask> if(this.inputProps&&this.inputProps.getRef){ <mask> this.inputProps.getRef(this._inputRef); <mask> } <mask> } </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove }else{ this.setState({isFocused:false}); </s> add </s> remove return true; </s> add </s> remove return false; </s> add </s> remove var hasIcon=icon&&icon.length; if(hasIcon){ icon.forEach(function(iconItem){ newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:iconItem.key},iconItem.props,{__source:{fileName:_jsxFileName,lineNumber:179}}))); }); } </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
<mask> if(this.props.floatingLabel){ <mask> if(this.inputProps&&this.inputProps.value){ <mask> this.setState({isFocused:true}); <mask> this.floatUp(-16); <mask> }else{ <mask> this.setState({isFocused:false}); <mask> } <mask> if(this.inputProps&&this.inputProps.getRef){ <mask> this.inputProps.getRef(this._inputRef); <mask> } <mask> } </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior.
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
<mask> forEach(function(item){ <mask> if(item.type.displayName==='Styled(Label)'){ <mask> labelChild=item; <mask> labelProps=item.props; <mask> return false; <mask> }else if(item.type.displayName==='Styled(Input)'){ <mask> inputChild=item; <mask> inputProps=item.props; <mask> _this4.inputProps=item.props; <mask> return false; </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove return false; </s> add </s> remove icon.push(item); </s> add icon.push({iconItem:item,isRight:!!inputChild}); </s> remove return false; </s> add </s> remove return false; </s> add </s> remove icon.push(item); </s> add icon.push({ iconItem: item, isRight: !!inputChild });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
<mask> }else if(item.type.displayName==='Styled(Input)'){ <mask> inputChild=item; <mask> inputProps=item.props; <mask> _this4.inputProps=item.props; <mask> return false; <mask> }else if(item.type.displayName==='Styled(Icon)'){ <mask> icon.push(item); <mask> iconProps=item.props; <mask> return false; <mask> } </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove icon.push(item); </s> add icon.push({iconItem:item,isRight:!!inputChild}); </s> remove return false; </s> add </s> remove return false; </s> add </s> remove return true; </s> add </s> remove return false; </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
icon.push({iconItem:item,isRight:!!inputChild});
<mask> inputProps=item.props; <mask> _this4.inputProps=item.props; <mask> return false; <mask> }else if(item.type.displayName==='Styled(Icon)'){ <mask> icon.push(item); <mask> iconProps=item.props; <mask> return false; <mask> } <mask> return true; <mask> }); </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove return false; </s> add </s> remove return false; </s> add </s> remove return false; </s> add </s> remove return true; </s> add </s> remove return false; </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
<mask> return false; <mask> }else if(item.type.displayName==='Styled(Icon)'){ <mask> icon.push(item); <mask> iconProps=item.props; <mask> return false; <mask> } <mask> return true; <mask> }); <mask> <mask> if(this.props.floatingLabel){ </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove icon.push(item); </s> add icon.push({iconItem:item,isRight:!!inputChild}); </s> remove return false; </s> add </s> remove return true; </s> add </s> remove return false; </s> add </s> remove icon.push(item); </s> add icon.push({ iconItem: item, isRight: !!inputChild });
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
<mask> icon.push(item); <mask> iconProps=item.props; <mask> return false; <mask> } <mask> return true; <mask> }); <mask> <mask> if(this.props.floatingLabel){ <mask> var hasIcon=icon&&icon.length; <mask> if(hasIcon){ </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove var hasIcon=icon&&icon.length; if(hasIcon){ icon.forEach(function(iconItem){ newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:iconItem.key},iconItem.props,{__source:{fileName:_jsxFileName,lineNumber:179}}))); }); } </s> add </s> remove return false; </s> add </s> remove icon.push(item); </s> add icon.push({iconItem:item,isRight:!!inputChild}); </s> remove return false; </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
<mask> return true; <mask> }); <mask> <mask> if(this.props.floatingLabel){ <mask> var hasIcon=icon&&icon.length; <mask> if(hasIcon){ <mask> icon.forEach(function(iconItem){ <mask> newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:iconItem.key},iconItem.props,{__source:{fileName:_jsxFileName,lineNumber:179}}))); <mask> }); <mask> } <mask> newChildren.push( <mask> _react2.default.createElement(_reactNative.Animated.View,{ <mask> key:"float", <mask> style:{ <mask> position:'absolute', </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove return true; </s> add </s> remove return false; </s> add </s> remove // if (this.props.floatingLabel && icon.length) { // let isIcon = false; // for (let i = 0; i < this.props.children.length; i++) { // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== "Styled(Input)") { // isIcon = true; // newChildren.push( // <Icon key={[i]} {...this.props.children[i].props} /> // ); // } // if (this.props.children[i].props.children) { // newChildren.push( // <Animated.View // key="float" // style={{ // position: "absolute", // left: // this.props.last && isIcon // ? 40 // : this.props.last // ? 15 // : isIcon // ? 26 // : 0, // right: 0, // top: this.state.topAnim, // opacity: this.state.opacAnim, // paddingTop: Platform.OS === "ios" ? undefined : undefined, // paddingBottom: Platform.OS === "ios" ? undefined : 12 // }} // > // <Label {...labelProps}> // {this.renderLabel(label, labelProps)} // </Label> // </Animated.View> // ); // newChildren.push( // <Input // ref={c => (this._inputRef = c)} // key="l2" // {...inputProps} // onFocus={() => { // this.setState({ isFocused: true }); // inputProps.onFocus && inputProps.onFocus(); // }} // onBlur={() => { // inputProps.value // ? this.setState({ // isFocused: true // }) // : !this.state.text.length && // this.setState({ isFocused: false }); // inputProps.onBlur && inputProps.onBlur(); // }} // onChangeText={text => { // this.setState({ text }); // inputProps.onChangeText && inputProps.onChangeText(text); // }} // /> // ); // } // } // } </s> add </s> remove icon.push(item); </s> add icon.push({ iconItem: item, isRight: !!inputChild });
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
paddingBottom:_reactNative.Platform.OS==='ios'?undefined:12},__source:{fileName:_jsxFileName,lineNumber:232}},
<mask> right:0, <mask> top:this.state.topAnim, <mask> opacity:this.state.opacAnim, <mask> paddingTop:_reactNative.Platform.OS==='ios'?undefined:undefined, <mask> paddingBottom:_reactNative.Platform.OS==='ios'?undefined:12},__source:{fileName:_jsxFileName,lineNumber:183}}, <mask> <mask> <mask> this.renderLabel(labelChild,labelProps))); <mask> <mask> </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove const hasIcon = icon && icon.length; if (hasIcon) { icon.forEach((iconItem) => { newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />); }); } </s> add </s> remove }else{ this.setState({isFocused:false}); </s> add </s> remove }else{ this.setState({isFocused:false}); </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
var hasIcon=icon&&icon.length; if(hasIcon){ icon.forEach(function(_ref){var iconItem=_ref.iconItem,isRight=_ref.isRight; console.log('iconItem',iconItem); console.log('isRight',isRight); var iconComponent=_react2.default.createElement(_Icon.Icon,_extends({key:iconItem.key},iconItem.props,{__source:{fileName:_jsxFileName,lineNumber:260}})); if(isRight){ newChildren.push(iconComponent); }else{ newChildren.unshift(iconComponent); } }); }
<mask> this.renderLabel(labelChild,labelProps))); <mask> <mask> <mask> newChildren.push(this.renderInput(inputChild,inputProps)); <mask> }else if(this.props.stackedLabel&&icon.length){ <mask> newChildren.push( <mask> _react2.default.createElement(_reactNative.View,{ <mask> key:"s", <mask> style:{ <mask> flexDirection:'row', </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:208}}, </s> add width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:270}}, </s> remove var hasIcon=icon&&icon.length; if(hasIcon){ icon.forEach(function(iconItem){ newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:iconItem.key},iconItem.props,{__source:{fileName:_jsxFileName,lineNumber:179}}))); }); } </s> add </s> remove paddingBottom:_reactNative.Platform.OS==='ios'?undefined:12},__source:{fileName:_jsxFileName,lineNumber:183}}, </s> add paddingBottom:_reactNative.Platform.OS==='ios'?undefined:12},__source:{fileName:_jsxFileName,lineNumber:232}}, </s> remove return false; </s> add </s> remove return false; </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:270}},
<mask> key:"s", <mask> style:{ <mask> flexDirection:'row', <mask> flex:1, <mask> width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:208}}, <mask> <mask> <mask> _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:216}})), <mask> _react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:217}}, <mask> _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:218}})), </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:216}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:217}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:218}})), </s> add _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:278}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:279}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:280}})), </s> remove var hasIcon=icon&&icon.length; if(hasIcon){ icon.forEach(function(iconItem){ newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:iconItem.key},iconItem.props,{__source:{fileName:_jsxFileName,lineNumber:179}}))); }); } </s> add </s> remove }else{ this.setState({isFocused:false}); </s> add </s> remove }else{ this.setState({isFocused:false}); </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
_react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:278}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:279}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:280}})),
<mask> flex:1, <mask> width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:208}}, <mask> <mask> <mask> _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:216}})), <mask> _react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'},__source:{fileName:_jsxFileName,lineNumber:217}}, <mask> _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:218}})), <mask> _react2.default.cloneElement(inputChild,_extends({}, <mask> inputProps,{ <mask> key:'s3', <mask> style:{width:_platform2.default.deviceWidth-40}}))))); <mask> </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:208}}, </s> add width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:270}}, </s> remove }else{ this.setState({isFocused:false}); </s> add </s> remove }else{ this.setState({isFocused:false}); </s> add </s> remove return false; </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:316}}),
<mask> return( <mask> _react2.default.createElement(_reactNative.TouchableOpacity,_extends({ <mask> ref:function ref(c){_this5._root=c;}}, <mask> this.prepareRootProps(),{ <mask> activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:254}}), <mask> <mask> this.renderChildren())); <mask> <mask> <mask> }}]);return Item;}(_react.Component); </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove }else{ this.setState({isFocused:false}); </s> add </s> remove }else{ this.setState({isFocused:false}); </s> add </s> remove return false; </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
<mask> Item);exports. <mask> <mask> <mask> Item=StyledItem; <mask> ======= <mask> Object.defineProperty(exports,"__esModule",{value:true});exports.Item=undefined;var _jsxFileName="src/basic/Item.js";var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();var _react=require("react");var _react2=_interopRequireDefault(_react);var _propTypes=require("prop-types");var _propTypes2=_interopRequireDefault(_propTypes);var _reactNative=require("react-native");var _Input=require("./Input");var _Label=require("./Label");var _Icon=require("./Icon");var _nativeBaseShoutemTheme=require("native-base-shoutem-theme");var _platform=require("../theme/variables/platform");var _platform2=_interopRequireDefault(_platform);var _computeProps=require("../utils/computeProps");var _computeProps2=_interopRequireDefault(_computeProps);var _mapPropsToStyleNames=require("../utils/mapPropsToStyleNames");var _mapPropsToStyleNames2=_interopRequireDefault(_mapPropsToStyleNames);var _lodash=require("lodash");var _lodash2=_interopRequireDefault(_lodash);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var Item=function(_Component){_inherits(Item,_Component);function Item(props){_classCallCheck(this,Item);var _this=_possibleConstructorReturn(this,(Item.__proto__||Object.getPrototypeOf(Item)).call(this,props));_this.state={text:"",topAnim:new _reactNative.Animated.Value(18),opacAnim:new _reactNative.Animated.Value(1)};return _this;}_createClass(Item,[{key:"componentDidMount",value:function componentDidMount(){if(this.props.floatingLabel){if(this.inputProps&&this.inputProps.value){this.setState({isFocused:true});this.floatUp(-16);}if(this.inputProps&&this.inputProps.getRef)this.inputProps.getRef(this._inputRef);}}},{key:"componentWillReceiveProps",value:function componentWillReceiveProps(nextProps){var _this2=this;var childrenArray=_react2.default.Children.toArray(nextProps.children);var inputProps={};_lodash2.default.remove(childrenArray,function(item){if(item.type.displayName==="Styled(Input)"){inputProps=item.props;_this2.inputProps=item.props;return item;}});if(this.props.floatingLabel){if(this.inputProps&&this.inputProps.value){this.setState({isFocused:true});this.floatUp(-16);}if(this.inputProps&&this.inputProps.getRef)this.inputProps.getRef(this._inputRef);}}},{key:"floatBack",value:function floatBack(){_reactNative.Animated.timing(this.state.topAnim,{toValue:18,duration:150}).start();_reactNative.Animated.timing(this.state.opacAnim,{toValue:1,duration:150}).start();}},{key:"floatUp",value:function floatUp(e){_reactNative.Animated.timing(this.state.topAnim,{toValue:e||-22,duration:150}).start();_reactNative.Animated.timing(this.state.opacAnim,{toValue:0.7,duration:150}).start();}},{key:"renderLabel",value:function renderLabel(label,labelProps){var newLabel=[];var labelStyle=_reactNative.StyleSheet.flatten({fontSize:15,lineHeight:30},labelProps.style);if(this.props.floatingLabel){if(this.state.isFocused){newLabel.push(_react2.default.createElement(_Label.Label,_extends({},labelProps,{key:"newFLabel",float:true,style:labelStyle})));this.floatUp(-16);}else{newLabel.push(label);this.floatBack();}}else{newLabel.push(_react2.default.createElement(_Label.Label,_extends({},labelProps,{key:"newLabel"})));}return newLabel;}},{key:"renderChildren",value:function renderChildren(){var _this3=this;var newChildren=[];var childrenArray=_react2.default.Children.toArray(this.props.children);var label=[];var labelProps={};label=_lodash2.default.remove(childrenArray,function(item){if(item.type===_Label.Label){labelProps=item.props;return item;}});var input=[];var inputProps={};input=_lodash2.default.remove(childrenArray,function(item){if(item.type===_Input.Input){inputProps=item.props;_this3.inputProps=item.props;return item;}});var icon=[];var iconProps={};icon=_lodash2.default.remove(childrenArray,function(item){if(item.type===_Icon.Icon){iconProps=item.props;return item;}});if(this.props.floatingLabel&&icon.length){var isIcon=false;for(var i=0;i<this.props.children.length;i++){if(this.props.children[i].props.name&&this.props.children[i].type.displayName!=="Styled(Input)"){isIcon=true;newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:[i]},this.props.children[i].props,{__source:{fileName:_jsxFileName,lineNumber:150}})));}if(this.props.children[i].props.children){newChildren.push(_react2.default.createElement(_reactNative.Animated.View,{key:"float",style:{position:"absolute",left:this.props.last&&isIcon?40:this.props.last?15:isIcon?26:0,right:0,top:this.state.topAnim,opacity:this.state.opacAnim,paddingTop:_reactNative.Platform.OS==="ios"?undefined:undefined,paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:155}},_react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:174}}),this.renderLabel(label,labelProps))));newChildren.push(_react2.default.createElement(_Input.Input,_extends({ref:function ref(c){return _this3._inputRef=c;},key:"l2"},inputProps,{onFocus:function onFocus(){_this3.setState({isFocused:true});inputProps.onFocus&&inputProps.onFocus();},onBlur:function onBlur(){inputProps.value?_this3.setState({isFocused:true}):!_this3.state.text.length&&_this3.setState({isFocused:false});inputProps.onBlur&&inputProps.onBlur();},onChangeText:function onChangeText(text){_this3.setState({text:text});inputProps.onChangeText&&inputProps.onChangeText(text);},__source:{fileName:_jsxFileName,lineNumber:180}})));}}}else if(this.props.floatingLabel){newChildren.push(_react2.default.createElement(_reactNative.Animated.View,{key:"float",style:{position:"absolute",left:this.props.last?15:0,right:0,top:this.state.topAnim,opacity:this.state.opacAnim,paddingTop:_reactNative.Platform.OS==="ios"?undefined:undefined,paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:207}},_react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:219}}),this.renderLabel(label,labelProps))));newChildren.push(_react2.default.createElement(_Input.Input,_extends({ref:function ref(c){return _this3._inputRef=c;},value:this.state.text,key:"l2"},inputProps,{onFocus:function onFocus(){_this3.setState({isFocused:true});inputProps.onFocus&&inputProps.onFocus();},onBlur:function onBlur(){inputProps.value?_this3.setState({isFocused:true}):!_this3.state.text.length&&_this3.setState({isFocused:false});inputProps.onBlur&&inputProps.onBlur();},onChangeText:function onChangeText(text){_this3.setState({text:text});inputProps.onChangeText&&inputProps.onChangeText(text);},__source:{fileName:_jsxFileName,lineNumber:223}})));}else if(this.props.stackedLabel&&icon.length){newChildren.push(_react2.default.createElement(_reactNative.View,{key:"s",style:{flexDirection:"row",flex:1,width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:248}},_react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:256}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:257}},_react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:258}})),_react2.default.createElement(_Input.Input,_extends({key:"s3"},inputProps,{style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:259}})))));}else{return this.props.children;}return newChildren;}},{key:"getInitialStyle",value:function getInitialStyle(){return{roundedInputGroup:{borderWidth:this.props.rounded?_platform2.default.borderWidth*2:undefined,borderRadius:this.props.rounded?_platform2.default.inputGroupRoundedBorderRadius:undefined}};}},{key:"prepareRootProps",value:function prepareRootProps(){var defaultProps={style:this.getInitialStyle().roundedInputGroup};return(0,_computeProps2.default)(this.props,defaultProps);}},{key:"render",value:function render(){var _this4=this;return _react2.default.createElement(_reactNative.TouchableOpacity,_extends({ref:function ref(c){return _this4._root=c;}},this.prepareRootProps(),{activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:292}}),this.renderChildren());}}]);return Item;}(_react.Component);var childrenType=function childrenType(props,propName,component){var error=void 0;var prop=props[propName];if(!props.children.length){error=new Error(component+" should have both Label and Input components");}else if(props.children[0].type.displayName!=="Styled(Label)"||props.children[1].type.displayName!=="Styled(Input)"){error=new Error(component+" should have Label and Input components only");}return error;};Item.propTypes=_extends({},_reactNative.TouchableOpacity.propTypes,{style:_propTypes2.default.oneOfType([_propTypes2.default.object,_propTypes2.default.number,_propTypes2.default.array]),inlineLabel:_propTypes2.default.bool,floatingLabel:_propTypes2.default.bool,stackedLabel:_propTypes2.default.bool,fixedLabel:_propTypes2.default.bool,success:_propTypes2.default.bool,error:_propTypes2.default.bool});var StyledItem=(0,_nativeBaseShoutemTheme.connectStyle)("NativeBase.Item",{},_mapPropsToStyleNames2.default)(Item);exports.Item=StyledItem; <mask> >>>>>>> master <mask> //# sourceMappingURL=Item.js.map </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove <<<<<<< HEAD </s> add </s> remove <<<<<<< HEAD {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD,CAHD,IAGO;AACL,KAAKD,QAAL,CAAc,CAAEJ,UAAW,KAAb,CAAd;AACD;AACD,GAAI,KAAKE,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAv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Ae8B,MAApB,CAA4B;AAC1B6C,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD,CAJD,IAIO;AACL9F,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACAsE,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBAhG,KAAKmG,SAAL;AACKC,8BAAiBD,SADtB;AAEE1D,MAAO4D,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} ======= {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B,2CACA,qC,mDACA,yCAOA,8BACA,8BACA,4BAEA,iEACA,qD,iDACA,mD,yDACA,mE,yEACA,8B,i7BAEMA,K,iDACJ,cAAYC,KAAZ,CAAmB,8HACXA,KADW,GAEjB,MAAKC,KAAL,CAAa,CACXC,KAAM,EADK,CAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE,CAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC,CAAb,CAFiB,aAOlB,C,8EACmB,CAClB,GAAI,KAAKL,KAAL,CAAWO,aAAf,CAA8B,CAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C,CAC5C,KAAKC,QAAL,CAAc,CAAEC,UAAW,IAAb,CAAd,EACA,KAAKC,OAAL,CAAa,CAAC,EAAd,EACD,CACD,GAAI,KAAKJ,UAAL,EAAmB,KAAKA,UAAL,CAAgBK,MAAvC,CACE,KAAKL,UAAL,CAAgBK,MAAhB,CAAuB,KAAKC,SAA5B,EACH,CACF,C,4EACyBC,S,CAAW,iBACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB,CACA,GAAIZ,YAAa,EAAjB,CACAa,iBAAEC,MAAF,CAASN,aAAT,CAAwB,cAAQ,CAC9B,GAAIO,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C,CAC7CjB,WAAae,KAAKvB,KAAlB,CACA,OAAK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CACHH,SADG,gDAAR,CAGD,CACD,MAAOC,MAAP,CACD,CAhBD,CAkBA7F,KAAKgG,SAAL,aACKC,8BAAiBD,SADtB,EAEExD,MAAO0D,oBAAUC,SAAV,CAAoB,CACzBD,oBAAUE,MADe,CAEzBF,oBAAUG,MAFe,CAGzBH,oBAAUI,KAHe,CAApB,CAFT,CAOEC,YAAaL,oBAAUM,IAPzB,CAQEhG,cAAe0F,oBAAUM,IAR3B,CASE/B,aAAcyB,oBAAUM,IAT1B,CAUEC,WAAYP,oBAAUM,IAVxB,CAWEE,QAASR,oBAAUM,IAXrB,CAYEX,MAAOK,oBAAUM,IAZnB,GAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} >>>>>>> master </s> add {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD;AACD,GAAI,KAAKH,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KA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,C,kBAhTgBC,gB;;;AAmTnB,GAAMC,cAAe,QAAfA,aAAe,CAAUjG,KAAV,CAAiBkG,QAAjB,CAA2BC,SAA3B,CAAsC;AACzD,GAAIC,aAAJ;AACA,GAAMC,MAAOrG,MAAMkG,QAAN,CAAb;AACA,GAAI,CAAClG,MAAMoB,QAAN,CAAe8B,MAApB,CAA4B;AAC1BkD,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD,CAJD,IAIO;AACLnG,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACA2E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} </s> remove }else{ this.setState({isFocused:false}); </s> add </s> remove }else{ this.setState({isFocused:false}); </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js
{"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD;AACD,GAAI,KAAKH,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAA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AAJ;AACA,GAAMC,MAAOrG,MAAMkG,QAAN,CAAb;AACA,GAAI,CAAClG,MAAMoB,QAAN,CAAe8B,MAApB,CAA4B;AAC1BkD,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD,CAJD,IAIO;AACLnG,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACA2E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]}
<mask> <<<<<<< HEAD <mask> {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD,CAHD,IAGO;AACL,KAAKD,QAAL,CAAc,CAAEJ,UAAW,KAAb,CAAd;AACD;AACD,GAAI,KAAKE,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C;AAC7C,OAAKhB,UAAL,CAAkBc,KAAKvB,KAAvB;AACA,MAAOuB,KAAP;AACD;AACD,MAAO,MAAP;AACD,CAND;AAOA,GAAI,KAAKvB,KA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AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} <mask> ======= <mask> {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B,2CACA,qC,mDACA,yCAOA,8BACA,8BACA,4BAEA,iEACA,qD,iDACA,mD,yDACA,mE,yEACA,8B,i7BAEMA,K,iDACJ,cAAYC,K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AAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} <mask> >>>>>>> master </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove // if (this.props.floatingLabel && icon.length) { // let isIcon = false; // for (let i = 0; i < this.props.children.length; i++) { // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== "Styled(Input)") { // isIcon = true; // newChildren.push( // <Icon key={[i]} {...this.props.children[i].props} /> // ); // } // if (this.props.children[i].props.children) { // newChildren.push( // <Animated.View // key="float" // style={{ // position: "absolute", // left: // this.props.last && isIcon // ? 40 // : this.props.last // ? 15 // : isIcon // ? 26 // : 0, // right: 0, // top: this.state.topAnim, // opacity: this.state.opacAnim, // paddingTop: Platform.OS === "ios" ? undefined : undefined, // paddingBottom: Platform.OS === "ios" ? undefined : 12 // }} // > // <Label {...labelProps}> // {this.renderLabel(label, labelProps)} // </Label> // </Animated.View> // ); // newChildren.push( // <Input // ref={c => (this._inputRef = c)} // key="l2" // {...inputProps} // onFocus={() => { // this.setState({ isFocused: true }); // inputProps.onFocus && inputProps.onFocus(); // }} // onBlur={() => { // inputProps.value // ? this.setState({ // isFocused: true // }) // : !this.state.text.length && // this.setState({ isFocused: false }); // inputProps.onBlur && inputProps.onBlur(); // }} // onChangeText={text => { // this.setState({ text }); // inputProps.onChangeText && inputProps.onChangeText(text); // }} // /> // ); // } // } // } </s> add </s> remove return false; </s> add </s> remove const hasIcon = icon && icon.length; if (hasIcon) { icon.forEach((iconItem) => { newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />); }); } </s> add </s> remove return true; </s> add
[ "replace", "replace", "replace", "replace", "replace" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
dist/src/basic/Item.js.map
<mask> .forEach((item) => { <mask> if (item.type.displayName === 'Styled(Label)') { <mask> labelChild = item; <mask> labelProps = item.props; <mask> return false; <mask> } else if (item.type.displayName === 'Styled(Input)') { <mask> inputChild = item; <mask> inputProps = item.props; <mask> this.inputProps = item.props; <mask> return false; </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove return false; </s> add </s> remove icon.push(item); </s> add icon.push({ iconItem: item, isRight: !!inputChild }); </s> remove return false; </s> add </s> remove <<<<<<< HEAD {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD,CAHD,IAGO;AACL,KAAKD,QAAL,CAAc,CAAEJ,UAAW,KAAb,CAAd;AACD;AACD,GAAI,KAAKE,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KA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E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBAhG,KAAKmG,SAAL;AACKC,8BAAiBD,SADtB;AAEE1D,MAAO4D,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} ======= {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLab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e0F,oBAAUM,IAR3B,CASE/B,aAAcyB,oBAAUM,IAT1B,CAUEC,WAAYP,oBAAUM,IAVxB,CAWEE,QAASR,oBAAUM,IAXrB,CAYEX,MAAOK,oBAAUM,IAZnB,GAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} >>>>>>> master </s> add {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD;AACD,GAAI,KAAKH,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C;AAC7C,OAA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ACHH,SADG,gDAAR;;AAGD,CAJD,IAIO;AACLnG,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACA2E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} </s> remove return true; </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
src/basic/Item.js
<mask> } else if (item.type.displayName === 'Styled(Input)') { <mask> inputChild = item; <mask> inputProps = item.props; <mask> this.inputProps = item.props; <mask> return false; <mask> } else if (item.type.displayName === 'Styled(Icon)') { <mask> icon.push(item); <mask> iconProps = item.props; <mask> return false; <mask> } </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove return false; </s> add </s> remove icon.push(item); </s> add icon.push({ iconItem: item, isRight: !!inputChild }); </s> remove return false; </s> add </s> remove <<<<<<< HEAD {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD,CAHD,IAGO;AACL,KAAKD,QAAL,CAAc,CAAEJ,UAAW,KAAb,CAAd;AACD;AACD,GAAI,KAAKE,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW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,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACAsE,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBAhG,KAAKmG,SAAL;AACKC,8BAAiBD,SADtB;AAEE1D,MAAO4D,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} ======= {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B,2CACA,qC,mDACA,yCAOA,8BACA,8BACA,4BAEA,iEACA,qD,iDACA,mD,yDACA,mE,yEACA,8B,i7BAEMA,K,iDACJ,cAAYC,KAAZ,CAAmB,8HACXA,KADW,GAEjB,MAAKC,KAAL,CAAa,CACXC,KAAM,EADK,CAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE,CAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC,CAAb,CAFiB,aAOlB,C,8EACmB,CAClB,GAAI,KAAKL,KAAL,CAAWO,aAAf,CAA8B,CAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C,CAC5C,KAAKC,QAAL,CAAc,CAAEC,UAAW,IAAb,CAAd,EACA,KAAKC,OAAL,CAAa,CAAC,EAAd,EACD,CACD,GAAI,KAAKJ,UAAL,EAAmB,KAAKA,UAAL,CAAgBK,MAAvC,CACE,KAAKL,UAAL,CAAgBK,MAAhB,CAAuB,KAAKC,SAA5B,EACH,CACF,C,4EACyBC,S,CAAW,iBACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB,CACA,GAAIZ,YAAa,EAAjB,CACAa,iBAAEC,MAAF,CAASN,aAAT,CAAwB,cAAQ,CAC9B,GAAIO,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C,CAC7CjB,WAAae,KAAKvB,KAAlB,CACA,OAAKQ,UAAL,CAAkBe,KAAKvB,KAAvB,CACA,MAAOuB,KAAP,CACD,CACF,CAND,EAOA,GAAI,KAAKvB,KAAL,CAAWO,a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EExD,MAAO0D,oBAAUC,SAAV,CAAoB,CACzBD,oBAAUE,MADe,CAEzBF,oBAAUG,MAFe,CAGzBH,oBAAUI,KAHe,CAApB,CAFT,CAOEC,YAAaL,oBAAUM,IAPzB,CAQEhG,cAAe0F,oBAAUM,IAR3B,CASE/B,aAAcyB,oBAAUM,IAT1B,CAUEC,WAAYP,oBAAUM,IAVxB,CAWEE,QAASR,oBAAUM,IAXrB,CAYEX,MAAOK,oBAAUM,IAZnB,GAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} >>>>>>> master </s> add {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD;AACD,GAAI,KAAKH,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuB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CAAsC;AACzD,GAAIC,aAAJ;AACA,GAAMC,MAAOrG,MAAMkG,QAAN,CAAb;AACA,GAAI,CAAClG,MAAMoB,QAAN,CAAe8B,MAApB,CAA4B;AAC1BkD,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD,CAJD,IAIO;AACLnG,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACA2E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} </s> remove return true; </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
src/basic/Item.js
icon.push({ iconItem: item, isRight: !!inputChild });
<mask> inputProps = item.props; <mask> this.inputProps = item.props; <mask> return false; <mask> } else if (item.type.displayName === 'Styled(Icon)') { <mask> icon.push(item); <mask> iconProps = item.props; <mask> return false; <mask> } <mask> return true; <mask> }); </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove return false; </s> add </s> remove return false; </s> add </s> remove return false; </s> add </s> remove return true; </s> add </s> remove <<<<<<< HEAD {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD,CAHD,IAGO;AACL,KAAKD,QAAL,CAAc,CAAEJ,UAAW,KAAb,CAAd;AACD;AACD,GAAI,KAAKE,UAAL,E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,GAAI,CAAC7F,MAAMoB,QAAN,CAAe8B,MAApB,CAA4B;AAC1B6C,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD,CAJD,IAIO;AACL9F,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACAsE,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBAhG,KAAKmG,SAAL;AACKC,8BAAiBD,SADtB;AAEE1D,MAAO4D,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} ======= {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B,2CACA,qC,mDACA,yCAOA,8BACA,8BACA,4BAEA,iEACA,qD,iDACA,mD,yDACA,mE,yEACA,8B,i7BAEMA,K,iDACJ,cAAYC,KAAZ,CAAmB,8HACXA,KADW,GAEjB,MAAKC,KAAL,CAAa,CACXC,KAAM,EADK,CAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE,CAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC,CAAb,CAFiB,aAOlB,C,8EACmB,CAClB,GAAI,KAAKL,KAAL,CAAWO,aAAf,CAA8B,CAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C,CAC5C,KAAKC,QAAL,CAAc,CAAEC,UAAW,IAAb,CAAd,EACA,KAAKC,OAAL,CAAa,CAAC,EAAd,EACD,CACD,GAAI,KAAKJ,UAAL,EAAmB,KAAKA,UAAL,CAAgBK,MAAvC,CACE,KAAKL,UAAL,CAAgBK,MAAhB,CAAuB,KAAKC,SAA5B,EACH,CACF,C,4EACyBC,S,CAAW,iBACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB,CACA,GAAIZ,YAAa,EAAjB,CACAa,iBAAEC,MAAF,CAASN,aAAT,CAAwB,cAAQ,CAC9B,GAAIO,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C,CAC7CjB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GL,CACAmE,MAAQ,GAAIE,MAAJ,CACHH,SADG,gDAAR,CAGD,CACD,MAAOC,MAAP,CACD,CAhBD,CAkBA7F,KAAKgG,SAAL,aACKC,8BAAiBD,SADtB,EAEExD,MAAO0D,oBAAUC,SAAV,CAAoB,CACzBD,oBAAUE,MADe,CAEzBF,oBAAUG,MAFe,CAGzBH,oBAAUI,KAHe,CAApB,CAFT,CAOEC,YAAaL,oBAAUM,IAPzB,CAQEhG,cAAe0F,oBAAUM,IAR3B,CASE/B,aAAcyB,oBAAUM,IAT1B,CAUEC,WAAYP,oBAAUM,IAVxB,CAWEE,QAASR,oBAAUM,IAXrB,CAYEX,MAAOK,oBAAUM,IAZnB,GAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} >>>>>>> master </s> add {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD;AACD,GAAI,KAAKH,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ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KG,KAAKC,cAAL,EALH,CADF;;;AASD,C,kBAhTgBC,gB;;;AAmTnB,GAAMC,cAAe,QAAfA,aAAe,CAAUjG,KAAV,CAAiBkG,QAAjB,CAA2BC,SAA3B,CAAsC;AACzD,GAAIC,aAAJ;AACA,GAAMC,MAAOrG,MAAMkG,QAAN,CAAb;AACA,GAAI,CAAClG,MAAMoB,QAAN,CAAe8B,MAApB,CAA4B;AAC1BkD,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD,CAJD,IAIO;AACLnG,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACA2E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]}
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
src/basic/Item.js
<mask> return false; <mask> } else if (item.type.displayName === 'Styled(Icon)') { <mask> icon.push(item); <mask> iconProps = item.props; <mask> return false; <mask> } <mask> return true; <mask> }); <mask> <mask> // if (this.props.floatingLabel && icon.length) { </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove return false; </s> add </s> remove icon.push(item); </s> add icon.push({ iconItem: item, isRight: !!inputChild }); </s> remove return true; </s> add </s> remove return false; </s> add </s> remove <<<<<<< HEAD {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAA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aAAe,CAAS5F,KAAT,CAAgB6F,QAAhB,CAA0BC,SAA1B,CAAqC;AACxD,GAAIC,aAAJ;AACA,GAAMC,MAAOhG,MAAM6F,QAAN,CAAb;AACA,GAAI,CAAC7F,MAAMoB,QAAN,CAAe8B,MAApB,CAA4B;AAC1B6C,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD,CAJD,IAIO;AACL9F,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACAsE,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBAhG,KAAKmG,SAAL;AACKC,8BAAiBD,SADtB;AAEE1D,MAAO4D,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} ======= {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B,2CACA,qC,mDACA,yCAOA,8BACA,8BACA,4BAEA,iEACA,qD,iDACA,mD,yDACA,mE,yEACA,8B,i7BAEMA,K,iDACJ,cAAYC,KAAZ,CAAmB,8HACXA,KADW,GAEjB,MAAKC,KAAL,CAAa,CACXC,KAAM,EADK,CAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE,CAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC,CAAb,CAFiB,aAOlB,C,8EACmB,CAClB,GAAI,KAAKL,KAAL,CAAWO,aAAf,CAA8B,CAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C,CAC5C,KAAKC,QAAL,CAAc,CAAEC,UAAW,IAAb,CAAd,EACA,KAAKC,OAAL,CAAa,CAAC,EAAd,EACD,CACD,GAAI,KAAKJ,UAAL,EAAmB,KAAKA,UAAL,CAAgBK,MAAvC,CACE,KAAKL,UAAL,CAAgBK,MAAhB,CAAuB,KAAKC,SAA5B,EACH,CACF,C,4EACyBC,S,CAAW,iBACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB,CACA,GAAIZ,YAAa,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AkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC,EACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC,CAGL,CACAmE,MAAQ,GAAIE,MAAJ,CACHH,SADG,gDAAR,CAGD,CACD,MAAOC,MAAP,CACD,CAhBD,CAkBA7F,KAAKgG,SAAL,aACKC,8BAAiBD,SADtB,EAEExD,MAAO0D,oBAAUC,SAAV,CAAoB,CACzBD,oBAAUE,MADe,CAEzBF,oBAAUG,MAFe,CAGzBH,oBAAUI,KAHe,CAApB,CAFT,CAOEC,YAAaL,oBAAUM,IAPzB,CAQEhG,cAAe0F,oBAAUM,IAR3B,CASE/B,aAAcyB,oBAAUM,IAT1B,CAUEC,WAAYP,oBAAUM,IAVxB,CAWEE,QAASR,oBAAUM,IAXrB,CAYEX,MAAOK,oBAAUM,IAZnB,GAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} >>>>>>> master </s> add {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAA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IAAK,aAAC5C,CAAD,CAAO,CAAE,OAAK8C,KAAL,CAAa9C,CAAb,CAAiB,CADjC;AAEM,KAAK+C,gBAAL,EAFN;AAGE,cAAe,CAHjB;;AAKG,KAAKC,cAAL,EALH,CADF;;;AASD,C,kBAhTgBC,gB;;;AAmTnB,GAAMC,cAAe,QAAfA,aAAe,CAAUjG,KAAV,CAAiBkG,QAAjB,CAA2BC,SAA3B,CAAsC;AACzD,GAAIC,aAAJ;AACA,GAAMC,MAAOrG,MAAMkG,QAAN,CAAb;AACA,GAAI,CAAClG,MAAMoB,QAAN,CAAe8B,MAApB,CAA4B;AAC1BkD,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD,CAJD,IAIO;AACLnG,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACA2E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]}
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
src/basic/Item.js
<mask> icon.push(item); <mask> iconProps = item.props; <mask> return false; <mask> } <mask> return true; <mask> }); <mask> <mask> // if (this.props.floatingLabel && icon.length) { <mask> // let isIcon = false; <mask> // for (let i = 0; i < this.props.children.length; i++) { </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove // if (this.props.floatingLabel && icon.length) { // let isIcon = false; // for (let i = 0; i < this.props.children.length; i++) { // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== "Styled(Input)") { // isIcon = true; // newChildren.push( // <Icon key={[i]} {...this.props.children[i].props} /> // ); // } // if (this.props.children[i].props.children) { // newChildren.push( // <Animated.View // key="float" // style={{ // position: "absolute", // left: // this.props.last && isIcon // ? 40 // : this.props.last // ? 15 // : isIcon // ? 26 // : 0, // right: 0, // top: this.state.topAnim, // opacity: this.state.opacAnim, // paddingTop: Platform.OS === "ios" ? undefined : undefined, // paddingBottom: Platform.OS === "ios" ? undefined : 12 // }} // > // <Label {...labelProps}> // {this.renderLabel(label, labelProps)} // </Label> // </Animated.View> // ); // newChildren.push( // <Input // ref={c => (this._inputRef = c)} // key="l2" // {...inputProps} // onFocus={() => { // this.setState({ isFocused: true }); // inputProps.onFocus && inputProps.onFocus(); // }} // onBlur={() => { // inputProps.value // ? this.setState({ // isFocused: true // }) // : !this.state.text.length && // this.setState({ isFocused: false }); // inputProps.onBlur && inputProps.onBlur(); // }} // onChangeText={text => { // this.setState({ text }); // inputProps.onChangeText && inputProps.onChangeText(text); // }} // /> // ); // } // } // } </s> add </s> remove return false; </s> add </s> remove <<<<<<< HEAD {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD,CAHD,IAGO;AACL,KAAKD,QAAL,CAAc,CAAEJ,UAAW,KAAb,CAAd;AACD;AACD,GAAI,KAAKE,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KAAKC,IAAL,CA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IE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBAhG,KAAKmG,SAAL;AACKC,8BAAiBD,SADtB;AAEE1D,MAAO4D,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} ======= {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","m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IAR3B,CASE/B,aAAcyB,oBAAUM,IAT1B,CAUEC,WAAYP,oBAAUM,IAVxB,CAWEE,QAASR,oBAAUM,IAXrB,CAYEX,MAAOK,oBAAUM,IAZnB,GAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} >>>>>>> master </s> add {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD;AACD,GAAI,KAAKH,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C;AAC7C,OAAKhB,UAAL,CA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AR;;AAGD,CAJD,IAIO;AACLnG,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACA2E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} </s> remove icon.push(item); </s> add icon.push({ iconItem: item, isRight: !!inputChild }); </s> remove return false; </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
src/basic/Item.js
<mask> } <mask> return true; <mask> }); <mask> <mask> // if (this.props.floatingLabel && icon.length) { <mask> // let isIcon = false; <mask> // for (let i = 0; i < this.props.children.length; i++) { <mask> // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== "Styled(Input)") { <mask> // isIcon = true; <mask> // newChildren.push( <mask> // <Icon key={[i]} {...this.props.children[i].props} /> <mask> // ); <mask> // } <mask> // if (this.props.children[i].props.children) { <mask> // newChildren.push( <mask> // <Animated.View <mask> // key="float" <mask> // style={{ <mask> // position: "absolute", <mask> // left: <mask> // this.props.last && isIcon <mask> // ? 40 <mask> // : this.props.last <mask> // ? 15 <mask> // : isIcon <mask> // ? 26 <mask> // : 0, <mask> // right: 0, <mask> // top: this.state.topAnim, <mask> // opacity: this.state.opacAnim, <mask> // paddingTop: Platform.OS === "ios" ? undefined : undefined, <mask> // paddingBottom: Platform.OS === "ios" ? undefined : 12 <mask> // }} <mask> // > <mask> // <Label {...labelProps}> <mask> // {this.renderLabel(label, labelProps)} <mask> // </Label> <mask> // </Animated.View> <mask> // ); <mask> // newChildren.push( <mask> // <Input <mask> // ref={c => (this._inputRef = c)} <mask> // key="l2" <mask> // {...inputProps} <mask> // onFocus={() => { <mask> // this.setState({ isFocused: true }); <mask> // inputProps.onFocus && inputProps.onFocus(); <mask> // }} <mask> // onBlur={() => { <mask> // inputProps.value <mask> // ? this.setState({ <mask> // isFocused: true <mask> // }) <mask> // : !this.state.text.length && <mask> // this.setState({ isFocused: false }); <mask> // inputProps.onBlur && inputProps.onBlur(); <mask> // }} <mask> // onChangeText={text => { <mask> // this.setState({ text }); <mask> // inputProps.onChangeText && inputProps.onChangeText(text); <mask> // }} <mask> // /> <mask> // ); <mask> // } <mask> // } <mask> // } <mask> <mask> if (this.props.floatingLabel) { <mask> const hasIcon = icon && icon.length; <mask> if (hasIcon) { <mask> icon.forEach((iconItem) => { <mask> newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />); </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove <<<<<<< HEAD {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD,CAHD,IAGO;AACL,KAAKD,QAAL,CAAc,CAAEJ,UAAW,KAAb,CAAd;AACD;AACD,GAAI,KAAKE,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C;AAC7C,OAAKhB,UAAL,CAAkBc,KAAKvB,KAAvB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KAAKmG,SAAL;AACKC,8BAAiBD,SADtB;AAEE1D,MAAO4D,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} ======= {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B,2CACA,qC,mDACA,yCAOA,8BACA,8BACA,4BAEA,i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AASR,oBAAUM,IAXrB,CAYEX,MAAOK,oBAAUM,IAZnB,GAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} >>>>>>> master </s> add {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD;AACD,GAAI,KAAKH,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C;AAC7C,OAAKhB,UAAL,CAAkBc,KAAKvB,KAAvB;AACA,MAAOuB,KAAP;AACD;AACD,MAAO,MAAP;AACD,CAND;AAOA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BC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACA2E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} </s> remove const hasIcon = icon && icon.length; if (hasIcon) { icon.forEach((iconItem) => { newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />); }); } </s> add </s> remove return true; </s> add </s> remove return false; </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
src/basic/Item.js
<mask> // } <mask> // } <mask> <mask> if (this.props.floatingLabel) { <mask> const hasIcon = icon && icon.length; <mask> if (hasIcon) { <mask> icon.forEach((iconItem) => { <mask> newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />); <mask> }); <mask> } <mask> newChildren.push( <mask> <Animated.View <mask> key="float" <mask> style={{ <mask> position: 'absolute', </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove // if (this.props.floatingLabel && icon.length) { // let isIcon = false; // for (let i = 0; i < this.props.children.length; i++) { // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== "Styled(Input)") { // isIcon = true; // newChildren.push( // <Icon key={[i]} {...this.props.children[i].props} /> // ); // } // if (this.props.children[i].props.children) { // newChildren.push( // <Animated.View // key="float" // style={{ // position: "absolute", // left: // this.props.last && isIcon // ? 40 // : this.props.last // ? 15 // : isIcon // ? 26 // : 0, // right: 0, // top: this.state.topAnim, // opacity: this.state.opacAnim, // paddingTop: Platform.OS === "ios" ? undefined : undefined, // paddingBottom: Platform.OS === "ios" ? undefined : 12 // }} // > // <Label {...labelProps}> // {this.renderLabel(label, labelProps)} // </Label> // </Animated.View> // ); // newChildren.push( // <Input // ref={c => (this._inputRef = c)} // key="l2" // {...inputProps} // onFocus={() => { // this.setState({ isFocused: true }); // inputProps.onFocus && inputProps.onFocus(); // }} // onBlur={() => { // inputProps.value // ? this.setState({ // isFocused: true // }) // : !this.state.text.length && // this.setState({ isFocused: false }); // inputProps.onBlur && inputProps.onBlur(); // }} // onChangeText={text => { // this.setState({ text }); // inputProps.onChangeText && inputProps.onChangeText(text); // }} // /> // ); // } // } // } </s> add </s> remove <<<<<<< HEAD {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD,CAHD,IAGO;AACL,KAAKD,QAAL,CAAc,CAAEJ,UAAW,KAAb,CAAd;AACD;AACD,GAAI,KAAKE,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eA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,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBAhG,KAAKmG,SAAL;AACKC,8BAAiBD,SADtB;AAEE1D,MAAO4D,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} ======= {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":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B,oBAAUM,IAT1B,CAUEC,WAAYP,oBAAUM,IAVxB,CAWEE,QAASR,oBAAUM,IAXrB,CAYEX,MAAOK,oBAAUM,IAZnB,GAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC,EACjB5G,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} >>>>>>> master </s> add {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD;AACD,GAAI,KAAKH,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C;AAC7C,OAAKhB,UAAL,CAAkBc,KAAKvB,KAAvB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O;AACLnG,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAAvC;AACAzB,MAAMoB,QAAN,CAAe,CAAf,EAAkBI,IAAlB,CAAuBC,WAAvB,GAAuC,eAFlC;AAGL;AACA2E,MAAQ,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} </s> remove return true; </s> add </s> remove return false; </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
src/basic/Item.js
const hasIcon = icon && icon.length; if (hasIcon) { icon.forEach(({ iconItem, isRight }) => { const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />; if (isRight) { newChildren.push(iconComponent); } else { newChildren.unshift(iconComponent); } }); }
<mask> ); <mask> newChildren.push(this.renderInput(inputChild, inputProps)); <mask> } else if (this.props.stackedLabel && icon.length) { <mask> newChildren.push( <mask> <View <mask> key="s" <mask> style={{ </s> Resolving merge conflicts and retaining icon original position Added a check to retain the "Icon" original position whenever used with "floatingLabel", which was the previous behavior. </s> remove // if (this.props.floatingLabel && icon.length) { // let isIcon = false; // for (let i = 0; i < this.props.children.length; i++) { // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== "Styled(Input)") { // isIcon = true; // newChildren.push( // <Icon key={[i]} {...this.props.children[i].props} /> // ); // } // if (this.props.children[i].props.children) { // newChildren.push( // <Animated.View // key="float" // style={{ // position: "absolute", // left: // this.props.last && isIcon // ? 40 // : this.props.last // ? 15 // : isIcon // ? 26 // : 0, // right: 0, // top: this.state.topAnim, // opacity: this.state.opacAnim, // paddingTop: Platform.OS === "ios" ? undefined : undefined, // paddingBottom: Platform.OS === "ios" ? undefined : 12 // }} // > // <Label {...labelProps}> // {this.renderLabel(label, labelProps)} // </Label> // </Animated.View> // ); // newChildren.push( // <Input // ref={c => (this._inputRef = c)} // key="l2" // {...inputProps} // onFocus={() => { // this.setState({ isFocused: true }); // inputProps.onFocus && inputProps.onFocus(); // }} // onBlur={() => { // inputProps.value // ? this.setState({ // isFocused: true // }) // : !this.state.text.length && // this.setState({ isFocused: false }); // inputProps.onBlur && inputProps.onBlur(); // }} // onChangeText={text => { // this.setState({ text }); // inputProps.onChangeText && inputProps.onChangeText(text); // }} // /> // ); // } // } // } </s> add </s> remove const hasIcon = icon && icon.length; if (hasIcon) { icon.forEach((iconItem) => { newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />); }); } </s> add </s> remove <<<<<<< HEAD {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","hasIcon","iconItem","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD,CAHD,IAGO;AACL,KAAKD,QAAL,CAAc,CAAEJ,UAAW,KAAb,CAAd;AACD;AACD,GAAI,KAAKE,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C;AAC7C,OAAKhB,UAAL,CAAkBc,KAAKvB,KAAvB;AACA,MAAOuB,KAAP;AACD;AACD,MAAO,MAAP;AACD,CAND;AAOA,GAAI,KAAKvB,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,U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zBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQElG,cAAe4F,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjB/G,IADiB,CAAnB,C;;;AAIuBA,I,CAAd8G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n } else {\n this.setState({ isFocused: false });\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n return false;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push(item);\n iconProps = item.props;\n return false;\n }\n return true;\n });\n\n if (this.props.floatingLabel) {\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach((iconItem) => {\n newChildren.push(<Icon key={iconItem.key} {...iconItem.props} />);\n });\n }\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function(props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} ======= {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","floatingLabel","inputProps","value","setState","isFocused","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","newLabel","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","push","createElement","Label","key","float","floatBack","newChildren","input","Input","icon","iconProps","Icon","length","isIcon","i","name","position","left","last","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","c","onFocus","onBlur","onChangeText","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B,2CACA,qC,mDACA,yCAOA,8BACA,8BACA,4BAEA,iEACA,qD,iDACA,mD,yDACA,mE,yEACA,8B,i7BAEMA,K,iDACJ,cAAYC,KAAZ,CAAmB,8HACXA,KADW,GAEjB,MAAKC,KAAL,CAAa,CACXC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,IADiB,CAAnB,C,QAIuBA,I,CAAd2G,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: \"\",\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1)\n };\n }\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n let inputProps = {};\n _.remove(childrenArray, item => {\n if (item.type.displayName === \"Styled(Input)\") {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef)\n this.inputProps.getRef(this._inputRef);\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150\n }).start();\n }\n\n renderLabel(label, labelProps) {\n const newLabel = [];\n let labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style\n );\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newFLabel\",\n float: true,\n style: labelStyle\n })\n );\n this.floatUp(-16);\n } else {\n newLabel.push(label);\n this.floatBack();\n }\n } else {\n newLabel.push(\n React.createElement(Label, {\n ...labelProps,\n key: \"newLabel\"\n })\n );\n }\n return newLabel;\n }\n\n renderChildren() {\n const newChildren = [];\n const childrenArray = React.Children.toArray(this.props.children);\n\n let label = [];\n let labelProps = {};\n label = _.remove(childrenArray, item => {\n if (item.type === Label) {\n labelProps = item.props;\n return item;\n }\n });\n\n let input = [];\n let inputProps = {};\n input = _.remove(childrenArray, item => {\n if (item.type === Input) {\n inputProps = item.props;\n this.inputProps = item.props;\n return item;\n }\n });\n\n let icon = [];\n let iconProps = {};\n icon = _.remove(childrenArray, item => {\n if (item.type === Icon) {\n iconProps = item.props;\n return item;\n }\n });\n if (this.props.floatingLabel && icon.length) {\n let isIcon = false;\n for (let i = 0; i < this.props.children.length; i++) {\n if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n isIcon = true;\n newChildren.push(\n <Icon key={[i]} {...this.props.children[i].props} />\n );\n }\n if (this.props.children[i].props.children) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left:\n this.props.last && isIcon\n ? 40\n : this.props.last\n ? 15\n : isIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>\n {this.renderLabel(label, labelProps)}\n </Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length &&\n this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n }\n }\n } else if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: \"absolute\",\n left: this.props.last ? 15 : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n }}\n >\n <Label {...labelProps}>{this.renderLabel(label, labelProps)}</Label>\n </Animated.View>\n );\n newChildren.push(\n <Input\n ref={c => (this._inputRef = c)}\n value={this.state.text}\n key=\"l2\"\n {...inputProps}\n onFocus={() => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n }}\n onBlur={() => {\n inputProps.value\n ? this.setState({\n isFocused: true\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n }}\n onChangeText={text => {\n this.setState({ text });\n inputProps.onChangeText && inputProps.onChangeText(text);\n }}\n />\n );\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: \"row\",\n flex: 1,\n width: variables.deviceWidth - 15\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: \"column\" }}>\n <Label key=\"s2\" {...labelProps} />\n <Input\n key=\"s3\"\n {...inputProps}\n style={{ width: variables.deviceWidth - 40 }}\n />\n </View>\n </View>\n );\n } else {\n return this.props.children;\n }\n return newChildren;\n }\n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined\n }\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup\n };\n\n return computeProps(this.props, defaultProps);\n }\n render() {\n return (\n <TouchableOpacity\n ref={c => (this._root = c)}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} >>>>>>> master </s> add {"version":3,"sources":["../../../src/basic/Item.js"],"names":["Item","props","state","text","topAnim","Animated","Value","opacAnim","isFocused","floatingLabel","inputProps","value","setState","floatUp","getRef","_inputRef","nextProps","childrenArray","React","Children","toArray","children","_","remove","item","type","displayName","timing","toValue","duration","start","e","label","labelProps","createElement","Label","labelStyle","StyleSheet","flatten","fontSize","lineHeight","style","cloneElement","key","float","floatBack","inputElement","ref","c","onFocus","onBlur","length","onChangeText","Input","labelChild","inputChild","icon","iconProps","newChildren","forEach","push","iconItem","isRight","position","left","last","hasIcon","right","top","opacity","paddingTop","Platform","OS","undefined","paddingBottom","renderLabel","renderInput","console","log","iconComponent","unshift","stackedLabel","flexDirection","flex","width","variables","deviceWidth","roundedInputGroup","borderWidth","rounded","borderRadius","inputGroupRoundedBorderRadius","defaultProps","getInitialStyle","_root","prepareRootProps","renderChildren","Component","childrenType","propName","component","error","prop","Error","propTypes","TouchableOpacity","PropTypes","oneOfType","object","number","array","inlineLabel","bool","fixedLabel","success","StyledItem","mapPropsToStyleNames"],"mappings":"m1BAAA,4B;AACA,qC;AACA;;;;;;;AAOA;AACA;AACA;;AAEA;AACA,qD;AACA,mD;AACA,mE;AACA,8B;;AAEMA,I;AACJ,cAAYC,KAAZ,CAAmB;AACXA,KADW;AAEjB,MAAKC,KAAL,CAAa;AACXC,KAAM,EADK;AAEXC,QAAS,GAAIC,uBAASC,KAAb,CAAmB,EAAnB,CAFE;AAGXC,SAAU,GAAIF,uBAASC,KAAb,CAAmB,CAAnB,CAHC;AAIXE,UAAW,KAJA,CAAb,CAFiB;;AAQlB,C;;AAEmB;AAClB,GAAI,KAAKP,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,KAAKC,QAAL,CAAc,CAAEJ,UAAW,IAAb,CAAd;AACA,KAAKK,OAAL,CAAa,CAAC,EAAd;AACD;AACD,GAAI,KAAKH,UAAL,EAAmB,KAAKA,UAAL,CAAgBI,MAAvC,CAA+C;AAC7C,KAAKJ,UAAL,CAAgBI,MAAhB,CAAuB,KAAKC,SAA5B;AACD;AACF;AACF,C;;AAEyBC,S,CAAW;AACnC,GAAMC,eAAgBC,gBAAMC,QAAN,CAAeC,OAAf,CAAuBJ,UAAUK,QAAjC,CAAtB;AACAC,iBAAEC,MAAF,CAASN,aAAT,CAAwB,SAACO,IAAD,CAAU;AAChC,GAAIA,KAAKC,IAAL,CAAUC,WAAV,GAA0B,eAA9B,CAA+C;AAC7C,OAAKhB,UAAL,CAAkBc,KAAKvB,KAAvB;AACA,MAAOuB,KAAP;AACD;AACD,MAAO,MAAP;AACD,CAND;AAOA,GAAI,KAAKvB,KAAL,CAAWQ,aAAf,CAA8B;AAC5B,GAAI,KAAKC,UAAL,EAAmB,KAAKA,UAAL,CAAgBC,KAAvC,CAA8C;AAC5C,K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Q,GAAIE,MAAJ;AACHH,SADG,gDAAR;;AAGD;AACD,MAAOC,MAAP;AACD,CAhBD;;AAkBArG,KAAKwG,SAAL;AACKC,8BAAiBD,SADtB;AAEE/D,MAAOiE,oBAAUC,SAAV,CAAoB;AACzBD,oBAAUE,MADe;AAEzBF,oBAAUG,MAFe;AAGzBH,oBAAUI,KAHe,CAApB,CAFT;;AAOEC,YAAaL,oBAAUM,IAPzB;AAQEvG,cAAeiG,oBAAUM,IAR3B;AASE/B,aAAcyB,oBAAUM,IAT1B;AAUEC,WAAYP,oBAAUM,IAVxB;AAWEE,QAASR,oBAAUM,IAXrB;AAYEX,MAAOK,oBAAUM,IAZnB;;;AAeA,GAAMG,YAAa,yCAAa,iBAAb,CAAgC,EAAhC,CAAoCC,8BAApC;AACjBpH,IADiB,CAAnB,C;;;AAIuBA,I,CAAdmH,U","file":"Item.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n TouchableOpacity,\n Animated,\n Platform,\n View,\n StyleSheet\n} from \"react-native\";\nimport { Input } from \"./Input\";\nimport { Label } from \"./Label\";\nimport { Icon } from \"./Icon\";\n\nimport { connectStyle } from \"native-base-shoutem-theme\";\nimport variables from \"../theme/variables/platform\";\nimport computeProps from \"../utils/computeProps\";\nimport mapPropsToStyleNames from \"../utils/mapPropsToStyleNames\";\nimport _ from \"lodash\";\n\nclass Item extends Component {\n constructor(props) {\n super(props);\n this.state = {\n text: '',\n topAnim: new Animated.Value(18),\n opacAnim: new Animated.Value(1),\n isFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n componentWillReceiveProps(nextProps) {\n const childrenArray = React.Children.toArray(nextProps.children);\n _.remove(childrenArray, (item) => {\n if (item.type.displayName === 'Styled(Input)') {\n this.inputProps = item.props;\n return item;\n }\n return false;\n });\n if (this.props.floatingLabel) {\n if (this.inputProps && this.inputProps.value) {\n this.setState({ isFocused: true });\n this.floatUp(-16);\n }\n if (this.inputProps && this.inputProps.getRef) {\n this.inputProps.getRef(this._inputRef);\n }\n }\n }\n\n floatBack() {\n Animated.timing(this.state.topAnim, {\n toValue: 18,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 1,\n duration: 150,\n }).start();\n }\n\n floatUp(e) {\n Animated.timing(this.state.topAnim, {\n toValue: e || -22,\n duration: 150,\n }).start();\n Animated.timing(this.state.opacAnim, {\n toValue: 0.7,\n duration: 150,\n }).start();\n }\n\n renderLabel(label, labelProps) {\n if (!label) {\n return React.createElement(Label, { ...labelProps });\n }\n\n if (this.props.floatingLabel) {\n if (this.state.isFocused) {\n const labelStyle = StyleSheet.flatten(\n { fontSize: 15, lineHeight: 30 },\n labelProps.style,\n );\n this.floatUp(-16);\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newFLabel',\n float: true,\n style: labelStyle,\n });\n }\n this.floatBack();\n return label;\n }\n return React.cloneElement(label, {\n ...labelProps,\n key: 'newLabel',\n });\n }\n\n renderInput(inputElement, inputProps) {\n const props = {\n value: this.state.text,\n ...inputProps,\n ref: (c) => { this._inputRef = c; },\n key: 'l2',\n onFocus: () => {\n this.setState({ isFocused: true });\n inputProps.onFocus && inputProps.onFocus();\n },\n onBlur: () => {\n inputProps.value\n ? this.setState({\n isFocused: true,\n })\n : !this.state.text.length && this.setState({ isFocused: false });\n inputProps.onBlur && inputProps.onBlur();\n },\n onChangeText: (text) => {\n this.setState({ text });\n inputProps.onChangeText && this.inputProps.onChangeText(text);\n },\n };\n\n if (!inputElement) {\n return React.createElement(Input, props);\n }\n return React.cloneElement(inputElement, props);\n }\n\n renderChildren() {\n let labelChild = null;\n let labelProps = {};\n let inputChild = null;\n let inputProps = {};\n const icon = [];\n let iconProps = {};\n let newChildren = [];\n\n React.Children.toArray(this.props.children)\n .forEach((item) => {\n if (item.type.displayName === 'Styled(Label)') {\n labelChild = item;\n labelProps = item.props;\n } else if (item.type.displayName === 'Styled(Input)') {\n inputChild = item;\n inputProps = item.props;\n this.inputProps = item.props;\n } else if (item.type.displayName === 'Styled(Icon)') {\n icon.push({ iconItem: item, isRight: !!inputChild });\n iconProps = item.props;\n }\n });\n\n // if (this.props.floatingLabel && icon.length) {\n // let isIcon = false;\n // for (let i = 0; i < this.props.children.length; i++) {\n // if (this.props.children[i].props.name && this.props.children[i].type.displayName !== \"Styled(Input)\") {\n // isIcon = true;\n // newChildren.push(\n // <Icon key={[i]} {...this.props.children[i].props} />\n // );\n // }\n // if (this.props.children[i].props.children) {\n // newChildren.push(\n // <Animated.View\n // key=\"float\"\n // style={{\n // position: \"absolute\",\n // left:\n // this.props.last && isIcon\n // ? 40\n // : this.props.last\n // ? 15\n // : isIcon\n // ? 26\n // : 0,\n // right: 0,\n // top: this.state.topAnim,\n // opacity: this.state.opacAnim,\n // paddingTop: Platform.OS === \"ios\" ? undefined : undefined,\n // paddingBottom: Platform.OS === \"ios\" ? undefined : 12\n // }}\n // >\n // <Label {...labelProps}>\n // {this.renderLabel(label, labelProps)}\n // </Label>\n // </Animated.View>\n // );\n // newChildren.push(\n // <Input\n // ref={c => (this._inputRef = c)}\n // key=\"l2\"\n // {...inputProps}\n // onFocus={() => {\n // this.setState({ isFocused: true });\n // inputProps.onFocus && inputProps.onFocus();\n // }}\n // onBlur={() => {\n // inputProps.value\n // ? this.setState({\n // isFocused: true\n // })\n // : !this.state.text.length &&\n // this.setState({ isFocused: false });\n // inputProps.onBlur && inputProps.onBlur();\n // }}\n // onChangeText={text => {\n // this.setState({ text });\n // inputProps.onChangeText && inputProps.onChangeText(text);\n // }}\n // />\n // );\n // }\n // }\n // }\n\n if (this.props.floatingLabel) {\n newChildren.push(\n <Animated.View\n key=\"float\"\n style={{\n position: 'absolute',\n left:\n this.props.last && hasIcon\n ? 40\n : this.props.last\n ? 15\n : hasIcon\n ? 26\n : 0,\n right: 0,\n top: this.state.topAnim,\n opacity: this.state.opacAnim,\n paddingTop: Platform.OS === 'ios' ? undefined : undefined,\n paddingBottom: Platform.OS === 'ios' ? undefined : 12,\n }}\n >\n {this.renderLabel(labelChild, labelProps)}\n </Animated.View>,\n );\n newChildren.push(this.renderInput(inputChild, inputProps));\n const hasIcon = icon && icon.length;\n if (hasIcon) {\n icon.forEach(({ iconItem, isRight }) => {\n console.log('iconItem', iconItem);\n console.log('isRight', isRight);\n const iconComponent = <Icon key={iconItem.key} {...iconItem.props} />;\n if (isRight) {\n newChildren.push(iconComponent);\n } else {\n newChildren.unshift(iconComponent);\n }\n });\n }\n } else if (this.props.stackedLabel && icon.length) {\n newChildren.push(\n <View\n key=\"s\"\n style={{\n flexDirection: 'row',\n flex: 1,\n width: variables.deviceWidth - 15,\n }}\n >\n <Icon key=\"s1\" {...iconProps} />\n <View style={{ flexDirection: 'column' }}>\n <Label key=\"s2\" {...labelProps} />\n {React.cloneElement(inputChild, {\n ...inputProps,\n key: 's3',\n style: { width: variables.deviceWidth - 40 },\n })}\n </View>\n </View>,\n );\n } else {\n newChildren = this.props.children;\n }\n return newChildren;\n }\n \n getInitialStyle() {\n return {\n roundedInputGroup: {\n borderWidth: this.props.rounded ? variables.borderWidth * 2 : undefined,\n borderRadius: this.props.rounded\n ? variables.inputGroupRoundedBorderRadius\n : undefined,\n },\n };\n }\n\n prepareRootProps() {\n const defaultProps = {\n style: this.getInitialStyle().roundedInputGroup,\n };\n\n return computeProps(this.props, defaultProps);\n }\n\n render() {\n return (\n <TouchableOpacity\n ref={(c) => { this._root = c; }}\n {...this.prepareRootProps()}\n activeOpacity={1}\n >\n {this.renderChildren()}\n </TouchableOpacity>\n );\n }\n}\n\nconst childrenType = function (props, propName, component) {\n let error;\n const prop = props[propName];\n if (!props.children.length) {\n error = new Error(\n `${component} should have both Label and Input components`\n );\n } else if (\n props.children[0].type.displayName !== \"Styled(Label)\" ||\n props.children[1].type.displayName !== \"Styled(Input)\"\n ) {\n error = new Error(\n `${component} should have Label and Input components only`\n );\n }\n return error;\n};\n\nItem.propTypes = {\n ...TouchableOpacity.propTypes,\n style: PropTypes.oneOfType([\n PropTypes.object,\n PropTypes.number,\n PropTypes.array\n ]),\n inlineLabel: PropTypes.bool,\n floatingLabel: PropTypes.bool,\n stackedLabel: PropTypes.bool,\n fixedLabel: PropTypes.bool,\n success: PropTypes.bool,\n error: PropTypes.bool\n};\n\nconst StyledItem = connectStyle(\"NativeBase.Item\", {}, mapPropsToStyleNames)(\n Item\n);\n\nexport { StyledItem as Item };\n"]} </s> remove return false; </s> add </s> remove return true; </s> add
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d37c2d4f1122fefd5fc53cb55b4215c367da1aaf
src/basic/Item.js
let breakpointsObj: any = {};
<mask> ) { <mask> const dimValues = Object.values(values); <mask> let index = -1; <mask> for (let i = 0; i < dimValues.length; i++) { <mask> breakpointsObj[dimValues[i]] = i; <mask> } <mask> const breakpoints = Object.keys(breakpointsObj); <mask> for (let i = 0; i < breakpoints.length; i++) { <mask> if (parseInt(breakpoints[i]) === point) { </s> fix: custom breakpoints not working as expected </s> remove else if (dimValues[i] < point && i === dimValues.length - 1) { index = i; </s> add else if (parseInt(breakpoints[i]) < point && i === dimValues.length - 1) { index = breakpointsObj[breakpoints[i]]; </s> remove } else if (dimValues[i] > point && i !== 0) { index = i - 1; </s> add } else if (parseInt(breakpoints[i]) > point && i !== 0) { index = breakpointsObj[breakpoints[i - 1]]; </s> remove if (dimValues[i] === point) { index = i; </s> add breakpointsObj[dimValues[i]] = i; } const breakpoints = Object.keys(breakpointsObj); for (let i = 0; i < breakpoints.length; i++) { if (parseInt(breakpoints[i]) === point) { index = breakpointsObj[breakpoints[i]];
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d434219625a724d99b9e60fe800bf7481699b01b
src/theme/tools/utils.ts
breakpointsObj[dimValues[i]] = i; } const breakpoints = Object.keys(breakpointsObj); for (let i = 0; i < breakpoints.length; i++) { if (parseInt(breakpoints[i]) === point) { index = breakpointsObj[breakpoints[i]];
<mask> ) { <mask> const dimValues = Object.values(values); <mask> let index = -1; <mask> for (let i = 0; i < dimValues.length; i++) { <mask> if (dimValues[i] === point) { <mask> index = i; <mask> break; <mask> } else if (dimValues[i] > point && i !== 0) { <mask> index = i - 1; <mask> break; <mask> } </s> fix: custom breakpoints not working as expected </s> remove else if (dimValues[i] < point && i === dimValues.length - 1) { index = i; </s> add else if (parseInt(breakpoints[i]) < point && i === dimValues.length - 1) { index = breakpointsObj[breakpoints[i]]; </s> remove } else if (dimValues[i] > point && i !== 0) { index = i - 1; </s> add } else if (parseInt(breakpoints[i]) > point && i !== 0) { index = breakpointsObj[breakpoints[i - 1]];
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d434219625a724d99b9e60fe800bf7481699b01b
src/theme/tools/utils.ts
} else if (parseInt(breakpoints[i]) > point && i !== 0) { index = breakpointsObj[breakpoints[i - 1]];
<mask> for (let i = 0; i < dimValues.length; i++) { <mask> if (dimValues[i] === point) { <mask> index = i; <mask> break; <mask> } else if (dimValues[i] > point && i !== 0) { <mask> index = i - 1; <mask> break; <mask> } <mask> // If windowWidth is greater than last available breakpoint clamp it to last index <mask> else if (dimValues[i] < point && i === dimValues.length - 1) { <mask> index = i; </s> fix: custom breakpoints not working as expected </s> remove else if (dimValues[i] < point && i === dimValues.length - 1) { index = i; </s> add else if (parseInt(breakpoints[i]) < point && i === dimValues.length - 1) { index = breakpointsObj[breakpoints[i]]; </s> remove if (dimValues[i] === point) { index = i; </s> add breakpointsObj[dimValues[i]] = i; } const breakpoints = Object.keys(breakpointsObj); for (let i = 0; i < breakpoints.length; i++) { if (parseInt(breakpoints[i]) === point) { index = breakpointsObj[breakpoints[i]];
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d434219625a724d99b9e60fe800bf7481699b01b
src/theme/tools/utils.ts
else if (parseInt(breakpoints[i]) < point && i === dimValues.length - 1) { index = breakpointsObj[breakpoints[i]];
<mask> index = i - 1; <mask> break; <mask> } <mask> // If windowWidth is greater than last available breakpoint clamp it to last index <mask> else if (dimValues[i] < point && i === dimValues.length - 1) { <mask> index = i; <mask> break; <mask> } <mask> } <mask> return index; <mask> } </s> fix: custom breakpoints not working as expected </s> remove if (dimValues[i] === point) { index = i; </s> add breakpointsObj[dimValues[i]] = i; } const breakpoints = Object.keys(breakpointsObj); for (let i = 0; i < breakpoints.length; i++) { if (parseInt(breakpoints[i]) === point) { index = breakpointsObj[breakpoints[i]]; </s> remove } else if (dimValues[i] > point && i !== 0) { index = i - 1; </s> add } else if (parseInt(breakpoints[i]) > point && i !== 0) { index = breakpointsObj[breakpoints[i - 1]];
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d434219625a724d99b9e60fe800bf7481699b01b
src/theme/tools/utils.ts
var labelStyle=_reactNative.StyleSheet.flatten( {fontSize:15,lineHeight:30}, labelProps.style);
<mask> }},{key:"renderLabel",value:function renderLabel( <mask> <mask> label,labelProps){ <mask> var newLabel=[]; <mask> var labelStyle=_reactNative.StyleSheet.flatten({fontSize:15,lineHeight:30},labelProps.style); <mask> if(this.props.floatingLabel){ <mask> if(this.state.isFocused){ <mask> newLabel.push( <mask> _react2.default.createElement(_Label.Label,_extends({}, <mask> labelProps,{ </s> floatinglabel renders icon, label and input in its order of definition </s> remove },__source:{fileName:_jsxFileName,lineNumber:154}}))); </s> add },__source:{fileName:_jsxFileName,lineNumber:172}}))); </s> remove top:6}}, </s> add top:6, paddingTop:8}, "NativeBase.IconNB":{ top:6, paddingTop:8}}, </s> remove activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:262}}), </s> add activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:283}}), </s> remove style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); </s> add style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:250}})))));
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
for(var i=0;i<this.props.children.length;i++){ if(this.props.children[i].props.name){ newChildren.push( _react2.default.createElement(_Icon.Icon,_extends({key:[i]},this.props.children[i].props,{__source:{fileName:_jsxFileName,lineNumber:148}}))); } if(this.props.children[i].props.children){
<mask> return item; <mask> } <mask> }); <mask> if(this.props.floatingLabel&&icon.length){ <mask> newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:"i1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:136}}))); <mask> newChildren.push( <mask> _react2.default.createElement(_reactNative.Animated.View,{ <mask> key:"float", <mask> style:{ <mask> position:"absolute", </s> floatinglabel renders icon, label and input in its order of definition </s> remove },__source:{fileName:_jsxFileName,lineNumber:154}}))); </s> add },__source:{fileName:_jsxFileName,lineNumber:172}}))); </s> remove width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:218}}, </s> add width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:239}}, </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:150}}),this.renderLabel(label,labelProps)))); </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:154}},
<mask> right:0, <mask> top:this.state.topAnim, <mask> opacity:this.state.opacAnim, <mask> paddingTop:_reactNative.Platform.OS==="ios"?undefined:undefined, <mask> paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:138}}, <mask> <mask> <mask> _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:150}}),this.renderLabel(label,labelProps)))); <mask> <mask> </s> floatinglabel renders icon, label and input in its order of definition </s> remove paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:177}}, </s> add paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:198}}, </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:150}}),this.renderLabel(label,labelProps)))); </s> add </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:189}}),this.renderLabel(label,labelProps)))); </s> add _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:210}}),this.renderLabel(label,labelProps)))); </s> remove top:6}}, </s> add top:6, paddingTop:8}, "NativeBase.IconNB":{ top:6, paddingTop:8}},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
_react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:166}}), this.renderLabel(label,labelProps))));
<mask> paddingTop:_reactNative.Platform.OS==="ios"?undefined:undefined, <mask> paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:154}}, <mask> <mask> <mask> <mask> <mask> <mask> newChildren.push( <mask> _react2.default.createElement(_Input.Input,_extends({ </s> floatinglabel renders icon, label and input in its order of definition </s> remove paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:138}}, </s> add paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:154}}, </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:150}}),this.renderLabel(label,labelProps)))); </s> add </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:189}}),this.renderLabel(label,labelProps)))); </s> add _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:210}}),this.renderLabel(label,labelProps)))); </s> remove style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); </s> add style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:250}}))))); </s> remove paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:177}}, </s> add paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:198}},
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
<mask> paddingTop:_reactNative.Platform.OS==="ios"?undefined:undefined, <mask> paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:138}}, <mask> <mask> <mask> _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:150}}),this.renderLabel(label,labelProps)))); <mask> <mask> <mask> newChildren.push( <mask> _react2.default.createElement(_Input.Input,_extends({ <mask> key:"l2"}, </s> floatinglabel renders icon, label and input in its order of definition </s> remove paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:138}}, </s> add paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:154}}, </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:189}}),this.renderLabel(label,labelProps)))); </s> add _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:210}}),this.renderLabel(label,labelProps)))); </s> remove style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); </s> add style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:250}}))))); </s> remove paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:177}}, </s> add paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:198}},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
!_this3.state.text.length&& _this3.setState({isFocused:false});
<mask> inputProps.value? <mask> _this3.setState({ <mask> isFocused:true}): <mask> <mask> !_this3.state.text.length&&_this3.setState({isFocused:false}); <mask> inputProps.onBlur&&inputProps.onBlur(); <mask> }, <mask> onChangeText:function onChangeText(text){ <mask> _this3.setState({text:text}); <mask> inputProps.onChangeText&&inputProps.onChangeText(text); </s> floatinglabel renders icon, label and input in its order of definition </s> remove },__source:{fileName:_jsxFileName,lineNumber:193}}))); </s> add },__source:{fileName:_jsxFileName,lineNumber:214}}))); </s> remove },__source:{fileName:_jsxFileName,lineNumber:154}}))); </s> add },__source:{fileName:_jsxFileName,lineNumber:172}}))); </s> remove top:6}}, </s> add top:6, paddingTop:8}, "NativeBase.IconNB":{ top:6, paddingTop:8}}, </s> remove activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:262}}), </s> add activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:283}}), </s> remove style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); </s> add style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:250}})))));
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
},__source:{fileName:_jsxFileName,lineNumber:172}})));
<mask> }, <mask> onChangeText:function onChangeText(text){ <mask> _this3.setState({text:text}); <mask> inputProps.onChangeText&&inputProps.onChangeText(text); <mask> },__source:{fileName:_jsxFileName,lineNumber:154}}))); <mask> <mask> <mask> }else if(this.props.floatingLabel){ <mask> newChildren.push( <mask> _react2.default.createElement(_reactNative.Animated.View,{ </s> floatinglabel renders icon, label and input in its order of definition </s> remove },__source:{fileName:_jsxFileName,lineNumber:193}}))); </s> add },__source:{fileName:_jsxFileName,lineNumber:214}}))); </s> remove !_this3.state.text.length&&_this3.setState({isFocused:false}); </s> add !_this3.state.text.length&& _this3.setState({isFocused:false}); </s> remove newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:"i1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:136}}))); </s> add for(var i=0;i<this.props.children.length;i++){ if(this.props.children[i].props.name){ newChildren.push( _react2.default.createElement(_Icon.Icon,_extends({key:[i]},this.props.children[i].props,{__source:{fileName:_jsxFileName,lineNumber:148}}))); } if(this.props.children[i].props.children){ </s> remove var labelStyle=_reactNative.StyleSheet.flatten({fontSize:15,lineHeight:30},labelProps.style); </s> add var labelStyle=_reactNative.StyleSheet.flatten( {fontSize:15,lineHeight:30}, labelProps.style);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
} }
<mask> },__source:{fileName:_jsxFileName,lineNumber:172}}))); <mask> <mask> <mask> }else if(this.props.floatingLabel){ <mask> newChildren.push( <mask> _react2.default.createElement(_reactNative.Animated.View,{ <mask> key:"float", <mask> style:{ </s> floatinglabel renders icon, label and input in its order of definition </s> remove },__source:{fileName:_jsxFileName,lineNumber:154}}))); </s> add },__source:{fileName:_jsxFileName,lineNumber:172}}))); </s> remove newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:"i1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:136}}))); </s> add for(var i=0;i<this.props.children.length;i++){ if(this.props.children[i].props.name){ newChildren.push( _react2.default.createElement(_Icon.Icon,_extends({key:[i]},this.props.children[i].props,{__source:{fileName:_jsxFileName,lineNumber:148}}))); } if(this.props.children[i].props.children){ </s> remove },__source:{fileName:_jsxFileName,lineNumber:193}}))); </s> add },__source:{fileName:_jsxFileName,lineNumber:214}}))); </s> remove width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:218}}, </s> add width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:239}}, </s> remove var labelStyle=_reactNative.StyleSheet.flatten({fontSize:15,lineHeight:30},labelProps.style); </s> add var labelStyle=_reactNative.StyleSheet.flatten( {fontSize:15,lineHeight:30}, labelProps.style);
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:198}},
<mask> right:0, <mask> top:this.state.topAnim, <mask> opacity:this.state.opacAnim, <mask> paddingTop:_reactNative.Platform.OS==="ios"?undefined:undefined, <mask> paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:177}}, <mask> <mask> <mask> _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:189}}),this.renderLabel(label,labelProps)))); <mask> <mask> </s> floatinglabel renders icon, label and input in its order of definition </s> remove paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:138}}, </s> add paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:154}}, </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:189}}),this.renderLabel(label,labelProps)))); </s> add _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:210}}),this.renderLabel(label,labelProps)))); </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:150}}),this.renderLabel(label,labelProps)))); </s> add </s> remove top:6}}, </s> add top:6, paddingTop:8}, "NativeBase.IconNB":{ top:6, paddingTop:8}},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
_react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:210}}),this.renderLabel(label,labelProps))));
<mask> paddingTop:_reactNative.Platform.OS==="ios"?undefined:undefined, <mask> paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:177}}, <mask> <mask> <mask> _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:189}}),this.renderLabel(label,labelProps)))); <mask> <mask> <mask> newChildren.push( <mask> _react2.default.createElement(_Input.Input,_extends({ <mask> ref:function ref(c){return _this3._inputRef=c;}, </s> floatinglabel renders icon, label and input in its order of definition </s> remove paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:177}}, </s> add paddingBottom:_reactNative.Platform.OS==="ios"?undefined:12},__source:{fileName:_jsxFileName,lineNumber:198}}, </s> remove activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:262}}), </s> add activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:283}}), </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:150}}),this.renderLabel(label,labelProps)))); </s> add </s> remove style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); </s> add style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:250}})))));
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
},__source:{fileName:_jsxFileName,lineNumber:214}})));
<mask> }, <mask> onChangeText:function onChangeText(text){ <mask> _this3.setState({text:text}); <mask> inputProps.onChangeText&&inputProps.onChangeText(text); <mask> },__source:{fileName:_jsxFileName,lineNumber:193}}))); <mask> <mask> <mask> }else if(this.props.stackedLabel&&icon.length){ <mask> newChildren.push( <mask> _react2.default.createElement(_reactNative.View,{ </s> floatinglabel renders icon, label and input in its order of definition </s> remove },__source:{fileName:_jsxFileName,lineNumber:154}}))); </s> add },__source:{fileName:_jsxFileName,lineNumber:172}}))); </s> remove !_this3.state.text.length&&_this3.setState({isFocused:false}); </s> add !_this3.state.text.length&& _this3.setState({isFocused:false}); </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:150}}),this.renderLabel(label,labelProps)))); </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:239}},
<mask> key:"s", <mask> style:{ <mask> flexDirection:"row", <mask> flex:1, <mask> width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:218}}, <mask> <mask> <mask> _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:226}})), <mask> _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:227}}, <mask> _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:228}})), </s> floatinglabel renders icon, label and input in its order of definition </s> remove _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:226}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:227}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:228}})), </s> add _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:247}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:248}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:249}})), </s> remove style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); </s> add style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:250}}))))); </s> remove newChildren.push(_react2.default.createElement(_Icon.Icon,_extends({key:"i1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:136}}))); </s> add for(var i=0;i<this.props.children.length;i++){ if(this.props.children[i].props.name){ newChildren.push( _react2.default.createElement(_Icon.Icon,_extends({key:[i]},this.props.children[i].props,{__source:{fileName:_jsxFileName,lineNumber:148}}))); } if(this.props.children[i].props.children){ </s> remove top:6}}, </s> add top:6, paddingTop:8}, "NativeBase.IconNB":{ top:6, paddingTop:8}},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
_react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:247}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:248}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:249}})),
<mask> flex:1, <mask> width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:218}}, <mask> <mask> <mask> _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:226}})), <mask> _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:227}}, <mask> _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:228}})), <mask> _react2.default.createElement(_Input.Input,_extends({ <mask> key:"s3"}, <mask> inputProps,{ <mask> style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); <mask> </s> floatinglabel renders icon, label and input in its order of definition </s> remove width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:218}}, </s> add width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:239}}, </s> remove style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); </s> add style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:250}}))))); </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:150}}),this.renderLabel(label,labelProps)))); </s> add </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:189}}),this.renderLabel(label,labelProps)))); </s> add _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:210}}),this.renderLabel(label,labelProps))));
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:250}})))));
<mask> _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:228}})), <mask> _react2.default.createElement(_Input.Input,_extends({ <mask> key:"s3"}, <mask> inputProps,{ <mask> style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); <mask> <mask> <mask> <mask> <mask> }else{ </s> floatinglabel renders icon, label and input in its order of definition </s> remove _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:226}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:227}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:228}})), </s> add _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:247}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:248}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:249}})), </s> remove width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:218}}, </s> add width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:239}}, </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:150}}),this.renderLabel(label,labelProps)))); </s> add </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:189}}),this.renderLabel(label,labelProps)))); </s> add _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:210}}),this.renderLabel(label,labelProps))));
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:283}}),
<mask> return( <mask> _react2.default.createElement(_reactNative.TouchableOpacity,_extends({ <mask> ref:function ref(c){return _this4._root=c;}}, <mask> this.prepareRootProps(),{ <mask> activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:262}}), <mask> <mask> this.renderChildren())); <mask> <mask> <mask> }}]);return Item;}(_react.Component); </s> floatinglabel renders icon, label and input in its order of definition </s> remove _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:189}}),this.renderLabel(label,labelProps)))); </s> add _react2.default.createElement(_Label.Label,_extends({},labelProps,{__source:{fileName:_jsxFileName,lineNumber:210}}),this.renderLabel(label,labelProps)))); </s> remove top:6}}, </s> add top:6, paddingTop:8}, "NativeBase.IconNB":{ top:6, paddingTop:8}}, </s> remove style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); </s> add style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:250}}))))); </s> remove _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:226}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:227}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:228}})), </s> add _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:247}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:248}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:249}})), </s> remove width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:218}}, </s> add width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:239}},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/basic/Item.js
top:6, paddingTop:8}, "NativeBase.IconNB":{ top:6, paddingTop:8}},
<mask> "NativeBase.Label":{ <mask> top:8}, <mask> <mask> "NativeBase.Icon":{ <mask> top:6}}, <mask> <mask> <mask> ".fixedLabel":{ <mask> "NativeBase.Label":{ <mask> position:null, </s> floatinglabel renders icon, label and input in its order of definition </s> remove activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:262}}), </s> add activeOpacity:1,__source:{fileName:_jsxFileName,lineNumber:283}}), </s> remove style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:229}}))))); </s> add style:{width:_platform2.default.deviceWidth-40},__source:{fileName:_jsxFileName,lineNumber:250}}))))); </s> remove _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:226}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:227}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:228}})), </s> add _react2.default.createElement(_Icon.Icon,_extends({key:"s1"},iconProps,{__source:{fileName:_jsxFileName,lineNumber:247}})), _react2.default.createElement(_reactNative.View,{style:{flexDirection:"column"},__source:{fileName:_jsxFileName,lineNumber:248}}, _react2.default.createElement(_Label.Label,_extends({key:"s2"},labelProps,{__source:{fileName:_jsxFileName,lineNumber:249}})), </s> remove width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:218}}, </s> add width:_platform2.default.deviceWidth-15},__source:{fileName:_jsxFileName,lineNumber:239}}, </s> remove },__source:{fileName:_jsxFileName,lineNumber:193}}))); </s> add },__source:{fileName:_jsxFileName,lineNumber:214}})));
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d51b2f94cadd4f60d2a17445c2b9f52d6a35597a
dist/src/theme/components/Item.js
newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{style:{width:_platform2.default.deviceWidth-40}})))));
<mask> newChildren.push(this.props.floatingLabel?_react2.default.createElement(_reactNative.Animated.View,{key:'float',style:{position:'absolute',left:this.props.last?15:0,right:0,top:this.state.topAnim,opacity:this.state.opacAnim,paddingTop:_reactNative.Platform.OS==='ios'?undefined:undefined,paddingBottom:_reactNative.Platform.OS==='ios'?undefined:12}},_react2.default.createElement(_Label.Label,{style:{fontSize:this.state.text?13:undefined}},this.renderLabel(label,labelProps))):_react2.default.createElement(_Label.Label,{style:{width:this.state.text?0:undefined,marginLeft:this.props.last?null:15}},this.renderLabel(label,labelProps))); <mask> newChildren.push(_react2.default.createElement(_Input.Input,_extends({key:'l2'},inputProps,{onChangeText:function onChangeText(text){_this2.setState({text:text});inputProps.onChangeText&&inputProps.onChangeText(text);}}))); <mask> }else <mask> if(this.props.stackedLabel&&icon.length){ <mask> newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{onChangeText:function onChangeText(text){return _this2.setState({text:text});},style:{width:_platform2.default.deviceWidth-40}}))))); <mask> <mask> }else <mask> { <mask> return this.props.children; <mask> } </s> Listitem ios highlight and android ripple fix </s> remove this.props.children)); </s> add _react2.default.createElement(_reactNative.View,this.props,this.props.children))); </s> remove _react2.default.createElement(_reactNative.TouchableOpacity,_extends({ ref:function ref(c){return _this2._root=c;}}, this.props,{activeOpacity:this.props.onPress?0.4:1}), </s> add _react2.default.createElement(_reactNative.TouchableHighlight,{ onPress:this.props.onPress, ref:function ref(c){return _this2._root=c;}, underlayColor:'#DDD'}, </s> remove {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} </s> add underlayColor="#DDD" </s> remove newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} onChangeText={text => this.setState({ text })} style={{ width: variables.deviceWidth - 40 }} /></View></View>); </s> add newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} style={{ width: variables.deviceWidth - 40 }} /></View></View>);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
dist/src/basic/Item.js
_react2.default.createElement(_reactNative.TouchableHighlight,{ onPress:this.props.onPress, ref:function ref(c){return _this2._root=c;}, underlayColor:'#DDD'},
<mask> ListItem=function(_Component){_inherits(ListItem,_Component);function ListItem(){_classCallCheck(this,ListItem);return _possibleConstructorReturn(this,(ListItem.__proto__||Object.getPrototypeOf(ListItem)).apply(this,arguments));}_createClass(ListItem,[{key:'render',value:function render() <mask> {var _this2=this; <mask> if(_reactNative.Platform.OS==='ios'||_platform2.default.androidRipple===false||!this.props.onPress){ <mask> return( <mask> _react2.default.createElement(_reactNative.TouchableOpacity,_extends({ <mask> ref:function ref(c){return _this2._root=c;}}, <mask> this.props,{activeOpacity:this.props.onPress?0.4:1}), <mask> <mask> this.props.children)); <mask> <mask> <mask> }else </s> Listitem ios highlight and android ripple fix </s> remove this.props.children)); </s> add _react2.default.createElement(_reactNative.View,this.props,this.props.children))); </s> remove _react2.default.createElement(_reactNative.View,this.props,this.props.children))); </s> add _react2.default.createElement(_reactNative.View,{style:{marginLeft:-17,paddingLeft:17}}, _react2.default.createElement(_reactNative.View,this.props,this.props.children)))); </s> remove newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{onChangeText:function onChangeText(text){return _this2.setState({text:text});},style:{width:_platform2.default.deviceWidth-40}}))))); </s> add newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{style:{width:_platform2.default.deviceWidth-40}}))))); </s> remove <TouchableOpacity </s> add <TouchableHighlight onPress={this.props.onPress} </s> remove {this.props.children} </TouchableOpacity> </s> add <View {...this.props}>{this.props.children}</View> </TouchableHighlight>
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
dist/src/basic/ListItem.js
_react2.default.createElement(_reactNative.View,this.props,this.props.children)));
<mask> _react2.default.createElement(_reactNative.TouchableOpacity,_extends({ <mask> ref:function ref(c){return _this2._root=c;}}, <mask> this.props,{activeOpacity:this.props.onPress?0.4:1}), <mask> <mask> this.props.children)); <mask> <mask> <mask> }else <mask> { <mask> return( </s> Listitem ios highlight and android ripple fix </s> remove _react2.default.createElement(_reactNative.TouchableOpacity,_extends({ ref:function ref(c){return _this2._root=c;}}, this.props,{activeOpacity:this.props.onPress?0.4:1}), </s> add _react2.default.createElement(_reactNative.TouchableHighlight,{ onPress:this.props.onPress, ref:function ref(c){return _this2._root=c;}, underlayColor:'#DDD'}, </s> remove newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{onChangeText:function onChangeText(text){return _this2.setState({text:text});},style:{width:_platform2.default.deviceWidth-40}}))))); </s> add newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{style:{width:_platform2.default.deviceWidth-40}}))))); </s> remove _react2.default.createElement(_reactNative.View,this.props,this.props.children))); </s> add _react2.default.createElement(_reactNative.View,{style:{marginLeft:-17,paddingLeft:17}}, _react2.default.createElement(_reactNative.View,this.props,this.props.children)))); </s> remove {this.props.children} </TouchableOpacity> </s> add <View {...this.props}>{this.props.children}</View> </TouchableHighlight>
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
dist/src/basic/ListItem.js
_react2.default.createElement(_reactNative.View,{style:{marginLeft:-17,paddingLeft:17}}, _react2.default.createElement(_reactNative.View,this.props,this.props.children))));
<mask> return( <mask> _react2.default.createElement(_reactNative.TouchableNativeFeedback,{ref:function ref(c){return _this2._root=c;}, <mask> onPress:this.props.onPress, <mask> background:this.props.androidRippleColor?_reactNative.TouchableNativeFeedback.Ripple(this.props.androidRippleColor):_reactNative.TouchableNativeFeedback.Ripple(_platform2.default.androidRippleColorDark)}, <mask> _react2.default.createElement(_reactNative.View,this.props,this.props.children))); <mask> <mask> <mask> } <mask> }}]);return ListItem;}(_react.Component); <mask> </s> Listitem ios highlight and android ripple fix </s> remove _react2.default.createElement(_reactNative.TouchableOpacity,_extends({ ref:function ref(c){return _this2._root=c;}}, this.props,{activeOpacity:this.props.onPress?0.4:1}), </s> add _react2.default.createElement(_reactNative.TouchableHighlight,{ onPress:this.props.onPress, ref:function ref(c){return _this2._root=c;}, underlayColor:'#DDD'}, </s> remove this.props.children)); </s> add _react2.default.createElement(_reactNative.View,this.props,this.props.children))); </s> remove _reactNative.TouchableOpacity.propTypes,{ </s> add _reactNative.TouchableHighlight.propTypes,{ </s> remove <View {...this.props}>{this.props.children}</View> </s> add <View style={{ marginLeft: -17, paddingLeft: 17 }}> <View {...this.props}>{this.props.children}</View> </View> </s> remove {this.props.children} </TouchableOpacity> </s> add <View {...this.props}>{this.props.children}</View> </TouchableHighlight>
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
dist/src/basic/ListItem.js
_reactNative.TouchableHighlight.propTypes,{
<mask> }}]);return ListItem;}(_react.Component); <mask> <mask> <mask> ListItem.propTypes=_extends({}, <mask> _reactNative.TouchableOpacity.propTypes,{ <mask> style:_react2.default.PropTypes.object, <mask> itemDivider:_react2.default.PropTypes.bool, <mask> button:_react2.default.PropTypes.bool}); <mask> <mask> </s> Listitem ios highlight and android ripple fix </s> remove _react2.default.createElement(_reactNative.View,this.props,this.props.children))); </s> add _react2.default.createElement(_reactNative.View,{style:{marginLeft:-17,paddingLeft:17}}, _react2.default.createElement(_reactNative.View,this.props,this.props.children)))); </s> remove ...TouchableOpacity.propTypes, </s> add ...TouchableHighlight.propTypes, </s> remove <View {...this.props}>{this.props.children}</View> </s> add <View style={{ marginLeft: -17, paddingLeft: 17 }}> <View {...this.props}>{this.props.children}</View> </View> </s> remove {this.props.children} </TouchableOpacity> </s> add <View {...this.props}>{this.props.children}</View> </TouchableHighlight> </s> remove {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} </s> add underlayColor="#DDD"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
dist/src/basic/ListItem.js
componentDidMount() { if(this.inputProps && this.inputProps.getRef) this.inputProps.getRef(this._inputRef); }
<mask> opacAnim: new Animated.Value(1), <mask> }; <mask> } <mask> <mask> floatBack() { <mask> Animated.timing(this.state.topAnim, { <mask> toValue: 18, <mask> duration: 150, </s> Listitem ios highlight and android ripple fix </s> remove ...TouchableOpacity.propTypes, </s> add ...TouchableHighlight.propTypes, </s> remove import { TouchableOpacity, Platform, TouchableNativeFeedback, View } from 'react-native'; </s> add import { TouchableHighlight, Platform, TouchableNativeFeedback, View } from 'react-native'; </s> remove newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{onChangeText:function onChangeText(text){return _this2.setState({text:text});},style:{width:_platform2.default.deviceWidth-40}}))))); </s> add newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{style:{width:_platform2.default.deviceWidth-40}}))))); </s> remove {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} </s> add underlayColor="#DDD"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
src/basic/Item.js
this.inputProps = item.props;
<mask> input = _.remove(childrenArray, (item) => { <mask> if (item.type === Input) { <mask> inputProps = item.props; <mask> return item; <mask> } <mask> }); <mask> <mask> let icon = []; </s> Listitem ios highlight and android ripple fix </s> remove newChildren.push(<Input key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); </s> add newChildren.push(<Input ref={(c) => this._inputRef = c} key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); </s> remove {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} </s> add underlayColor="#DDD" </s> remove <TouchableOpacity </s> add <TouchableHighlight onPress={this.props.onPress} </s> remove newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} onChangeText={text => this.setState({ text })} style={{ width: variables.deviceWidth - 40 }} /></View></View>); </s> add newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} style={{ width: variables.deviceWidth - 40 }} /></View></View>); </s> remove newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{onChangeText:function onChangeText(text){return _this2.setState({text:text});},style:{width:_platform2.default.deviceWidth-40}}))))); </s> add newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{style:{width:_platform2.default.deviceWidth-40}})))));
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
src/basic/Item.js
newChildren.push(<Input ref={(c) => this._inputRef = c} key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />);
<mask> newChildren.push(<Input key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); <mask> } <mask> else if (this.props.floatingLabel) { <mask> newChildren.push((this.props.floatingLabel) ? <Animated.View key="float" style={{ position: 'absolute', left: (this.props.last) ? 15 : 0, right: 0, top: this.state.topAnim, opacity: this.state.opacAnim, paddingTop: (Platform.OS === 'ios') ? undefined : undefined, paddingBottom: (Platform.OS === 'ios') ? undefined : 12 }}><Label style={{fontSize: (this.state.text) ? 13 : undefined}}>{this.renderLabel(label, labelProps)}</Label></Animated.View> : <Label style={{width: (this.state.text) ? 0 : undefined, marginLeft: (this.props.last) ? null : 15}}>{this.renderLabel(label, labelProps)}</Label>); <mask> newChildren.push(<Input key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); <mask> } <mask> else if (this.props.stackedLabel && icon.length) { <mask> newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} onChangeText={text => this.setState({ text })} style={{ width: variables.deviceWidth - 40 }} /></View></View>); <mask> <mask> } </s> Listitem ios highlight and android ripple fix </s> remove newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} onChangeText={text => this.setState({ text })} style={{ width: variables.deviceWidth - 40 }} /></View></View>); </s> add newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} style={{ width: variables.deviceWidth - 40 }} /></View></View>); </s> remove <View {...this.props}>{this.props.children}</View> </s> add <View style={{ marginLeft: -17, paddingLeft: 17 }}> <View {...this.props}>{this.props.children}</View> </View> </s> remove {this.props.children} </TouchableOpacity> </s> add <View {...this.props}>{this.props.children}</View> </TouchableHighlight> </s> remove {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} </s> add underlayColor="#DDD"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
src/basic/Item.js
newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} style={{ width: variables.deviceWidth - 40 }} /></View></View>);
<mask> newChildren.push((this.props.floatingLabel) ? <Animated.View key="float" style={{ position: 'absolute', left: (this.props.last) ? 15 : 0, right: 0, top: this.state.topAnim, opacity: this.state.opacAnim, paddingTop: (Platform.OS === 'ios') ? undefined : undefined, paddingBottom: (Platform.OS === 'ios') ? undefined : 12 }}><Label style={{fontSize: (this.state.text) ? 13 : undefined}}>{this.renderLabel(label, labelProps)}</Label></Animated.View> : <Label style={{width: (this.state.text) ? 0 : undefined, marginLeft: (this.props.last) ? null : 15}}>{this.renderLabel(label, labelProps)}</Label>); <mask> newChildren.push(<Input key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); <mask> } <mask> else if (this.props.stackedLabel && icon.length) { <mask> newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} onChangeText={text => this.setState({ text })} style={{ width: variables.deviceWidth - 40 }} /></View></View>); <mask> <mask> } <mask> else { <mask> return this.props.children; <mask> } </s> Listitem ios highlight and android ripple fix </s> remove newChildren.push(<Input key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); </s> add newChildren.push(<Input ref={(c) => this._inputRef = c} key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); </s> remove <View {...this.props}>{this.props.children}</View> </s> add <View style={{ marginLeft: -17, paddingLeft: 17 }}> <View {...this.props}>{this.props.children}</View> </View> </s> remove {this.props.children} </TouchableOpacity> </s> add <View {...this.props}>{this.props.children}</View> </TouchableHighlight> </s> remove {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} </s> add underlayColor="#DDD"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
src/basic/Item.js
import { TouchableHighlight, Platform, TouchableNativeFeedback, View } from 'react-native';
<mask> import React, { Component } from 'react'; <mask> import { TouchableOpacity, Platform, TouchableNativeFeedback, View } from 'react-native'; <mask> <mask> import { connectStyle } from '@shoutem/theme'; <mask> import mapPropsToStyleNames from '../Utils/mapPropsToStyleNames'; <mask> import variable from '../theme/variables/platform'; <mask> </s> Listitem ios highlight and android ripple fix </s> remove ...TouchableOpacity.propTypes, </s> add ...TouchableHighlight.propTypes, </s> remove <TouchableOpacity </s> add <TouchableHighlight onPress={this.props.onPress} </s> remove newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{onChangeText:function onChangeText(text){return _this2.setState({text:text});},style:{width:_platform2.default.deviceWidth-40}}))))); </s> add newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{style:{width:_platform2.default.deviceWidth-40}})))));
[ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
src/basic/ListItem.js
<TouchableHighlight onPress={this.props.onPress}
<mask> class ListItem extends Component { <mask> render() { <mask> if (Platform.OS==='ios' || variable.androidRipple===false || !this.props.onPress) { <mask> return ( <mask> <TouchableOpacity <mask> ref={c => this._root = c} <mask> {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} <mask> > <mask> {this.props.children} <mask> </TouchableOpacity> </s> Listitem ios highlight and android ripple fix </s> remove {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} </s> add underlayColor="#DDD" </s> remove {this.props.children} </TouchableOpacity> </s> add <View {...this.props}>{this.props.children}</View> </TouchableHighlight> </s> remove import { TouchableOpacity, Platform, TouchableNativeFeedback, View } from 'react-native'; </s> add import { TouchableHighlight, Platform, TouchableNativeFeedback, View } from 'react-native'; </s> remove <View {...this.props}>{this.props.children}</View> </s> add <View style={{ marginLeft: -17, paddingLeft: 17 }}> <View {...this.props}>{this.props.children}</View> </View>
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
src/basic/ListItem.js
underlayColor="#DDD"
<mask> if (Platform.OS==='ios' || variable.androidRipple===false || !this.props.onPress) { <mask> return ( <mask> <TouchableOpacity <mask> ref={c => this._root = c} <mask> {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} <mask> > <mask> {this.props.children} <mask> </TouchableOpacity> <mask> ); <mask> } </s> Listitem ios highlight and android ripple fix </s> remove <TouchableOpacity </s> add <TouchableHighlight onPress={this.props.onPress} </s> remove {this.props.children} </TouchableOpacity> </s> add <View {...this.props}>{this.props.children}</View> </TouchableHighlight> </s> remove <View {...this.props}>{this.props.children}</View> </s> add <View style={{ marginLeft: -17, paddingLeft: 17 }}> <View {...this.props}>{this.props.children}</View> </View> </s> remove newChildren.push(<Input key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); </s> add newChildren.push(<Input ref={(c) => this._inputRef = c} key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
src/basic/ListItem.js
<View {...this.props}>{this.props.children}</View> </TouchableHighlight>
<mask> <TouchableOpacity <mask> ref={c => this._root = c} <mask> {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} <mask> > <mask> {this.props.children} <mask> </TouchableOpacity> <mask> ); <mask> } <mask> else { <mask> return( <mask> <TouchableNativeFeedback ref={c => this._root = c} </s> Listitem ios highlight and android ripple fix </s> remove {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} </s> add underlayColor="#DDD" </s> remove <TouchableOpacity </s> add <TouchableHighlight onPress={this.props.onPress} </s> remove <View {...this.props}>{this.props.children}</View> </s> add <View style={{ marginLeft: -17, paddingLeft: 17 }}> <View {...this.props}>{this.props.children}</View> </View> </s> remove newChildren.push(<Input key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); </s> add newChildren.push(<Input ref={(c) => this._inputRef = c} key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); </s> remove newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} onChangeText={text => this.setState({ text })} style={{ width: variables.deviceWidth - 40 }} /></View></View>); </s> add newChildren.push(<View key="s" style={{ flexDirection: 'row', flex: 1, width: variables.deviceWidth - 15 }}><Icon key="s1" {...iconProps} style={{ marginTop: 36 }} /><View style={{ flexDirection: 'column' }}><Label key="s2" {...labelProps}></Label><Input key="s3" {...inputProps} style={{ width: variables.deviceWidth - 40 }} /></View></View>);
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
src/basic/ListItem.js
<View style={{ marginLeft: -17, paddingLeft: 17 }}> <View {...this.props}>{this.props.children}</View> </View>
<mask> return( <mask> <TouchableNativeFeedback ref={c => this._root = c} <mask> onPress={this.props.onPress} <mask> background={(this.props.androidRippleColor) ? TouchableNativeFeedback.Ripple(this.props.androidRippleColor) : TouchableNativeFeedback.Ripple(variable.androidRippleColorDark)}> <mask> <View {...this.props}>{this.props.children}</View> <mask> </TouchableNativeFeedback> <mask> ); <mask> } <mask> } <mask> } </s> Listitem ios highlight and android ripple fix </s> remove {this.props.children} </TouchableOpacity> </s> add <View {...this.props}>{this.props.children}</View> </TouchableHighlight> </s> remove {...this.props} activeOpacity={(this.props.onPress) ? 0.4 : 1} </s> add underlayColor="#DDD" </s> remove <TouchableOpacity </s> add <TouchableHighlight onPress={this.props.onPress} </s> remove newChildren.push(<Input key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); </s> add newChildren.push(<Input ref={(c) => this._inputRef = c} key="l2" {...inputProps} onChangeText={text => {this.setState({ text }); (inputProps.onChangeText) && inputProps.onChangeText(text) }} />); </s> remove _react2.default.createElement(_reactNative.View,this.props,this.props.children))); </s> add _react2.default.createElement(_reactNative.View,{style:{marginLeft:-17,paddingLeft:17}}, _react2.default.createElement(_reactNative.View,this.props,this.props.children))));
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
src/basic/ListItem.js
...TouchableHighlight.propTypes,
<mask> } <mask> } <mask> <mask> ListItem.propTypes = { <mask> ...TouchableOpacity.propTypes, <mask> style: React.PropTypes.object, <mask> itemDivider: React.PropTypes.bool, <mask> button: React.PropTypes.bool, <mask> }; <mask> </s> Listitem ios highlight and android ripple fix </s> remove import { TouchableOpacity, Platform, TouchableNativeFeedback, View } from 'react-native'; </s> add import { TouchableHighlight, Platform, TouchableNativeFeedback, View } from 'react-native'; </s> remove newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{onChangeText:function onChangeText(text){return _this2.setState({text:text});},style:{width:_platform2.default.deviceWidth-40}}))))); </s> add newChildren.push(_react2.default.createElement(_reactNative.View,{key:'s',style:{flexDirection:'row',flex:1,width:_platform2.default.deviceWidth-15}},_react2.default.createElement(_Icon.Icon,_extends({key:'s1'},iconProps,{style:{marginTop:36}})),_react2.default.createElement(_reactNative.View,{style:{flexDirection:'column'}},_react2.default.createElement(_Label.Label,_extends({key:'s2'},labelProps)),_react2.default.createElement(_Input.Input,_extends({key:'s3'},inputProps,{style:{width:_platform2.default.deviceWidth-40}}))))); </s> remove <View {...this.props}>{this.props.children}</View> </s> add <View style={{ marginLeft: -17, paddingLeft: 17 }}> <View {...this.props}>{this.props.children}</View> </View>
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d523c66b2e9d4634d7b63dd113b1dd68a3807e34
src/basic/ListItem.js
import Flex from '../../primitives/Flex';
<mask> import isNil from 'lodash/isNil'; <mask> import React from 'react'; <mask> import styled from 'styled-components/native'; <mask> import { border, color, flexbox, layout, position, space } from 'styled-system'; <mask> import { useThemeProps } from '../../../hooks'; <mask> import { <mask> customBackground, <mask> customBorder, <mask> customExtra, <mask> customFlexBox, <mask> customLayout, <mask> customOutline, <mask> customPosition, <mask> customShadow, <mask> } from '../../../utils/customProps'; <mask> import Box from '../../primitives/Box'; <mask> import type { IWrapProps } from './types'; <mask> <mask> const StyledWrap = styled(Box)<IWrapProps>( <mask> color, <mask> space, </s> fix: refactor for wrap component, now it uses flex component </s> remove const StyledWrap = styled(Box)<IWrapProps>( color, space, layout, flexbox, border, position, customPosition, customBorder, customBackground, customOutline, customShadow, customExtra, customLayout, customFlexBox ); const Wrap = ( { style, spacing, children, direction, align, justify, grow, basis, ...props }: IWrapProps, ref?: any ) => { let newProps = useThemeProps('Wrap', props); </s> add const Wrap = ({ spacing, children, ...props }: IWrapProps, ref?: any) => { </s> remove import type { ViewProps, ViewStyle } from 'react-native'; import type * as CSS from 'csstype'; import type { BorderProps, ColorProps, FlexboxProps, LayoutProps, PositionProps, SpaceProps, } from 'styled-system'; </s> add import type { IFlexProps } from './../../primitives/Flex/types'; </s> remove import Wrap from './wrap'; </s> add </s> remove import type { customBorderProps, customBackgroundProps, customOutlineProps, customLayoutProps, customExtraProps, customShadowProps, customFlexboxProps, customPositionProps, } from '../../../utils/customProps'; export type IWrapProps = ViewProps & ColorProps & SpaceProps & LayoutProps & FlexboxProps & PositionProps & customBorderProps & customExtraProps & customOutlineProps & customShadowProps & customLayoutProps & customBackgroundProps & customFlexboxProps & customPositionProps & BorderProps & { style?: ViewStyle; children?: JSX.Element | JSX.Element[]; direction?: CSS.Property.FlexDirection | undefined; align?: CSS.Property.AlignItems | undefined; justify?: CSS.Property.JustifyContent | undefined; wrap?: CSS.Property.FlexWrap | undefined; basis?: CSS.Property.FlexBasis | undefined; grow?: CSS.Property.FlexGrow | undefined; spacing?: number; }; </s> add export type IWrapProps = IFlexProps & { spacing?: number; }; </s> remove </StyledWrap> </s> add </Flex>
[ "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5a24a0b590292dd7e83d6645bfd874dea11c134
src/components/composites/Wrap/index.tsx
const Wrap = ({ spacing, children, ...props }: IWrapProps, ref?: any) => {
<mask> } from '../../../utils/customProps'; <mask> import Box from '../../primitives/Box'; <mask> import type { IWrapProps } from './types'; <mask> <mask> const StyledWrap = styled(Box)<IWrapProps>( <mask> color, <mask> space, <mask> layout, <mask> flexbox, <mask> border, <mask> position, <mask> customPosition, <mask> customBorder, <mask> customBackground, <mask> customOutline, <mask> customShadow, <mask> customExtra, <mask> customLayout, <mask> customFlexBox <mask> ); <mask> const Wrap = ( <mask> { <mask> style, <mask> spacing, <mask> children, <mask> direction, <mask> align, <mask> justify, <mask> grow, <mask> basis, <mask> ...props <mask> }: IWrapProps, <mask> ref?: any <mask> ) => { <mask> let newProps = useThemeProps('Wrap', props); <mask> return ( <mask> <StyledWrap <mask> {...newProps} <mask> flexDirection={direction} <mask> alignItems={align} </s> fix: refactor for wrap component, now it uses flex component </s> remove import styled from 'styled-components/native'; import { border, color, flexbox, layout, position, space } from 'styled-system'; import { useThemeProps } from '../../../hooks'; import { customBackground, customBorder, customExtra, customFlexBox, customLayout, customOutline, customPosition, customShadow, } from '../../../utils/customProps'; import Box from '../../primitives/Box'; </s> add import Flex from '../../primitives/Flex'; </s> remove <StyledWrap {...newProps} flexDirection={direction} alignItems={align} justifyContent={justify} flexGrow={grow} flexBasis={basis} style={style} ref={ref} > </s> add <Flex {...props} wrap="wrap" ref={ref}> </s> remove import Wrap from './wrap'; </s> add </s> remove import type { ViewProps, ViewStyle } from 'react-native'; import type * as CSS from 'csstype'; import type { BorderProps, ColorProps, FlexboxProps, LayoutProps, PositionProps, SpaceProps, } from 'styled-system'; </s> add import type { IFlexProps } from './../../primitives/Flex/types'; </s> remove </StyledWrap> </s> add </Flex>
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5a24a0b590292dd7e83d6645bfd874dea11c134
src/components/composites/Wrap/index.tsx
<Flex {...props} wrap="wrap" ref={ref}>
<mask> ref?: any <mask> ) => { <mask> let newProps = useThemeProps('Wrap', props); <mask> return ( <mask> <StyledWrap <mask> {...newProps} <mask> flexDirection={direction} <mask> alignItems={align} <mask> justifyContent={justify} <mask> flexGrow={grow} <mask> flexBasis={basis} <mask> style={style} <mask> ref={ref} <mask> > <mask> {isNil(spacing) <mask> ? children <mask> : React.Children.map(children, (child: any) => { <mask> return React.cloneElement( <mask> child, </s> fix: refactor for wrap component, now it uses flex component </s> remove const StyledWrap = styled(Box)<IWrapProps>( color, space, layout, flexbox, border, position, customPosition, customBorder, customBackground, customOutline, customShadow, customExtra, customLayout, customFlexBox ); const Wrap = ( { style, spacing, children, direction, align, justify, grow, basis, ...props }: IWrapProps, ref?: any ) => { let newProps = useThemeProps('Wrap', props); </s> add const Wrap = ({ spacing, children, ...props }: IWrapProps, ref?: any) => { </s> remove </StyledWrap> </s> add </Flex> </s> remove import type { ViewProps, ViewStyle } from 'react-native'; import type * as CSS from 'csstype'; import type { BorderProps, ColorProps, FlexboxProps, LayoutProps, PositionProps, SpaceProps, } from 'styled-system'; </s> add import type { IFlexProps } from './../../primitives/Flex/types'; </s> remove import styled from 'styled-components/native'; import { border, color, flexbox, layout, position, space } from 'styled-system'; import { useThemeProps } from '../../../hooks'; import { customBackground, customBorder, customExtra, customFlexBox, customLayout, customOutline, customPosition, customShadow, } from '../../../utils/customProps'; import Box from '../../primitives/Box'; </s> add import Flex from '../../primitives/Flex'; </s> remove import Wrap from './wrap'; </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5a24a0b590292dd7e83d6645bfd874dea11c134
src/components/composites/Wrap/index.tsx
</Flex>
<mask> { ...props, style: { margin: spacing } }, <mask> child.props.children <mask> ); <mask> })} <mask> </StyledWrap> <mask> ); <mask> }; <mask> <mask> export default React.memo(React.forwardRef(Wrap)); <mask> export type { IWrapProps }; </s> fix: refactor for wrap component, now it uses flex component </s> remove import Wrap from './wrap'; </s> add </s> remove import type { customBorderProps, customBackgroundProps, customOutlineProps, customLayoutProps, customExtraProps, customShadowProps, customFlexboxProps, customPositionProps, } from '../../../utils/customProps'; export type IWrapProps = ViewProps & ColorProps & SpaceProps & LayoutProps & FlexboxProps & PositionProps & customBorderProps & customExtraProps & customOutlineProps & customShadowProps & customLayoutProps & customBackgroundProps & customFlexboxProps & customPositionProps & BorderProps & { style?: ViewStyle; children?: JSX.Element | JSX.Element[]; direction?: CSS.Property.FlexDirection | undefined; align?: CSS.Property.AlignItems | undefined; justify?: CSS.Property.JustifyContent | undefined; wrap?: CSS.Property.FlexWrap | undefined; basis?: CSS.Property.FlexBasis | undefined; grow?: CSS.Property.FlexGrow | undefined; spacing?: number; }; </s> add export type IWrapProps = IFlexProps & { spacing?: number; }; </s> remove const StyledWrap = styled(Box)<IWrapProps>( color, space, layout, flexbox, border, position, customPosition, customBorder, customBackground, customOutline, customShadow, customExtra, customLayout, customFlexBox ); const Wrap = ( { style, spacing, children, direction, align, justify, grow, basis, ...props }: IWrapProps, ref?: any ) => { let newProps = useThemeProps('Wrap', props); </s> add const Wrap = ({ spacing, children, ...props }: IWrapProps, ref?: any) => { </s> remove import type { ViewProps, ViewStyle } from 'react-native'; import type * as CSS from 'csstype'; import type { BorderProps, ColorProps, FlexboxProps, LayoutProps, PositionProps, SpaceProps, } from 'styled-system'; </s> add import type { IFlexProps } from './../../primitives/Flex/types'; </s> remove import styled from 'styled-components/native'; import { border, color, flexbox, layout, position, space } from 'styled-system'; import { useThemeProps } from '../../../hooks'; import { customBackground, customBorder, customExtra, customFlexBox, customLayout, customOutline, customPosition, customShadow, } from '../../../utils/customProps'; import Box from '../../primitives/Box'; </s> add import Flex from '../../primitives/Flex';
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5a24a0b590292dd7e83d6645bfd874dea11c134
src/components/composites/Wrap/index.tsx
import type { IFlexProps } from './../../primitives/Flex/types';
<mask> import type { ViewProps, ViewStyle } from 'react-native'; <mask> import type * as CSS from 'csstype'; <mask> import type { <mask> BorderProps, <mask> ColorProps, <mask> FlexboxProps, <mask> LayoutProps, <mask> PositionProps, <mask> SpaceProps, <mask> } from 'styled-system'; <mask> <mask> import type { <mask> customBorderProps, <mask> customBackgroundProps, <mask> customOutlineProps, </s> fix: refactor for wrap component, now it uses flex component </s> remove import type { customBorderProps, customBackgroundProps, customOutlineProps, customLayoutProps, customExtraProps, customShadowProps, customFlexboxProps, customPositionProps, } from '../../../utils/customProps'; export type IWrapProps = ViewProps & ColorProps & SpaceProps & LayoutProps & FlexboxProps & PositionProps & customBorderProps & customExtraProps & customOutlineProps & customShadowProps & customLayoutProps & customBackgroundProps & customFlexboxProps & customPositionProps & BorderProps & { style?: ViewStyle; children?: JSX.Element | JSX.Element[]; direction?: CSS.Property.FlexDirection | undefined; align?: CSS.Property.AlignItems | undefined; justify?: CSS.Property.JustifyContent | undefined; wrap?: CSS.Property.FlexWrap | undefined; basis?: CSS.Property.FlexBasis | undefined; grow?: CSS.Property.FlexGrow | undefined; spacing?: number; }; </s> add export type IWrapProps = IFlexProps & { spacing?: number; }; </s> remove import styled from 'styled-components/native'; import { border, color, flexbox, layout, position, space } from 'styled-system'; import { useThemeProps } from '../../../hooks'; import { customBackground, customBorder, customExtra, customFlexBox, customLayout, customOutline, customPosition, customShadow, } from '../../../utils/customProps'; import Box from '../../primitives/Box'; </s> add import Flex from '../../primitives/Flex'; </s> remove import Wrap from './wrap'; </s> add </s> remove const StyledWrap = styled(Box)<IWrapProps>( color, space, layout, flexbox, border, position, customPosition, customBorder, customBackground, customOutline, customShadow, customExtra, customLayout, customFlexBox ); const Wrap = ( { style, spacing, children, direction, align, justify, grow, basis, ...props }: IWrapProps, ref?: any ) => { let newProps = useThemeProps('Wrap', props); </s> add const Wrap = ({ spacing, children, ...props }: IWrapProps, ref?: any) => { </s> remove </StyledWrap> </s> add </Flex>
[ "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5a24a0b590292dd7e83d6645bfd874dea11c134
src/components/composites/Wrap/types.ts
export type IWrapProps = IFlexProps & { spacing?: number; };
<mask> PositionProps, <mask> SpaceProps, <mask> } from 'styled-system'; <mask> <mask> import type { <mask> customBorderProps, <mask> customBackgroundProps, <mask> customOutlineProps, <mask> customLayoutProps, <mask> customExtraProps, <mask> customShadowProps, <mask> customFlexboxProps, <mask> customPositionProps, <mask> } from '../../../utils/customProps'; <mask> <mask> export type IWrapProps = ViewProps & <mask> ColorProps & <mask> SpaceProps & <mask> LayoutProps & <mask> FlexboxProps & <mask> PositionProps & <mask> customBorderProps & <mask> customExtraProps & <mask> customOutlineProps & <mask> customShadowProps & <mask> customLayoutProps & <mask> customBackgroundProps & <mask> customFlexboxProps & <mask> customPositionProps & <mask> BorderProps & { <mask> style?: ViewStyle; <mask> children?: JSX.Element | JSX.Element[]; <mask> direction?: CSS.Property.FlexDirection | undefined; <mask> align?: CSS.Property.AlignItems | undefined; <mask> justify?: CSS.Property.JustifyContent | undefined; <mask> wrap?: CSS.Property.FlexWrap | undefined; <mask> basis?: CSS.Property.FlexBasis | undefined; <mask> grow?: CSS.Property.FlexGrow | undefined; <mask> spacing?: number; <mask> }; </s> fix: refactor for wrap component, now it uses flex component </s> remove import type { ViewProps, ViewStyle } from 'react-native'; import type * as CSS from 'csstype'; import type { BorderProps, ColorProps, FlexboxProps, LayoutProps, PositionProps, SpaceProps, } from 'styled-system'; </s> add import type { IFlexProps } from './../../primitives/Flex/types'; </s> remove import styled from 'styled-components/native'; import { border, color, flexbox, layout, position, space } from 'styled-system'; import { useThemeProps } from '../../../hooks'; import { customBackground, customBorder, customExtra, customFlexBox, customLayout, customOutline, customPosition, customShadow, } from '../../../utils/customProps'; import Box from '../../primitives/Box'; </s> add import Flex from '../../primitives/Flex'; </s> remove </StyledWrap> </s> add </Flex> </s> remove import Wrap from './wrap'; </s> add </s> remove const StyledWrap = styled(Box)<IWrapProps>( color, space, layout, flexbox, border, position, customPosition, customBorder, customBackground, customOutline, customShadow, customExtra, customLayout, customFlexBox ); const Wrap = ( { style, spacing, children, direction, align, justify, grow, basis, ...props }: IWrapProps, ref?: any ) => { let newProps = useThemeProps('Wrap', props); </s> add const Wrap = ({ spacing, children, ...props }: IWrapProps, ref?: any) => {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace" ]
https://github.com/GeekyAnts/NativeBase/commit/d5a24a0b590292dd7e83d6645bfd874dea11c134
src/components/composites/Wrap/types.ts
<mask> import AppBar from './app-bar'; <mask> import TextArea from './textarea'; <mask> import Toast from './toast'; <mask> import { Fade, ScaleFade, Slide, SlideFade } from './transitions'; <mask> import Wrap from './wrap'; <mask> import List from './list'; <mask> <mask> export default { <mask> Accordion, <mask> AccordionItem, </s> fix: refactor for wrap component, now it uses flex component </s> remove import styled from 'styled-components/native'; import { border, color, flexbox, layout, position, space } from 'styled-system'; import { useThemeProps } from '../../../hooks'; import { customBackground, customBorder, customExtra, customFlexBox, customLayout, customOutline, customPosition, customShadow, } from '../../../utils/customProps'; import Box from '../../primitives/Box'; </s> add import Flex from '../../primitives/Flex'; </s> remove import type { ViewProps, ViewStyle } from 'react-native'; import type * as CSS from 'csstype'; import type { BorderProps, ColorProps, FlexboxProps, LayoutProps, PositionProps, SpaceProps, } from 'styled-system'; </s> add import type { IFlexProps } from './../../primitives/Flex/types'; </s> remove const StyledWrap = styled(Box)<IWrapProps>( color, space, layout, flexbox, border, position, customPosition, customBorder, customBackground, customOutline, customShadow, customExtra, customLayout, customFlexBox ); const Wrap = ( { style, spacing, children, direction, align, justify, grow, basis, ...props }: IWrapProps, ref?: any ) => { let newProps = useThemeProps('Wrap', props); </s> add const Wrap = ({ spacing, children, ...props }: IWrapProps, ref?: any) => { </s> remove import type { customBorderProps, customBackgroundProps, customOutlineProps, customLayoutProps, customExtraProps, customShadowProps, customFlexboxProps, customPositionProps, } from '../../../utils/customProps'; export type IWrapProps = ViewProps & ColorProps & SpaceProps & LayoutProps & FlexboxProps & PositionProps & customBorderProps & customExtraProps & customOutlineProps & customShadowProps & customLayoutProps & customBackgroundProps & customFlexboxProps & customPositionProps & BorderProps & { style?: ViewStyle; children?: JSX.Element | JSX.Element[]; direction?: CSS.Property.FlexDirection | undefined; align?: CSS.Property.AlignItems | undefined; justify?: CSS.Property.JustifyContent | undefined; wrap?: CSS.Property.FlexWrap | undefined; basis?: CSS.Property.FlexBasis | undefined; grow?: CSS.Property.FlexGrow | undefined; spacing?: number; }; </s> add export type IWrapProps = IFlexProps & { spacing?: number; }; </s> remove </StyledWrap> </s> add </Flex>
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5a24a0b590292dd7e83d6645bfd874dea11c134
src/theme/components/index.ts
<mask> Text, <mask> AppBar, <mask> TextArea, <mask> Toast, <mask> Wrap, <mask> }; </s> fix: refactor for wrap component, now it uses flex component </s> remove </StyledWrap> </s> add </Flex> </s> remove import type { customBorderProps, customBackgroundProps, customOutlineProps, customLayoutProps, customExtraProps, customShadowProps, customFlexboxProps, customPositionProps, } from '../../../utils/customProps'; export type IWrapProps = ViewProps & ColorProps & SpaceProps & LayoutProps & FlexboxProps & PositionProps & customBorderProps & customExtraProps & customOutlineProps & customShadowProps & customLayoutProps & customBackgroundProps & customFlexboxProps & customPositionProps & BorderProps & { style?: ViewStyle; children?: JSX.Element | JSX.Element[]; direction?: CSS.Property.FlexDirection | undefined; align?: CSS.Property.AlignItems | undefined; justify?: CSS.Property.JustifyContent | undefined; wrap?: CSS.Property.FlexWrap | undefined; basis?: CSS.Property.FlexBasis | undefined; grow?: CSS.Property.FlexGrow | undefined; spacing?: number; }; </s> add export type IWrapProps = IFlexProps & { spacing?: number; }; </s> remove import Wrap from './wrap'; </s> add </s> remove import type { ViewProps, ViewStyle } from 'react-native'; import type * as CSS from 'csstype'; import type { BorderProps, ColorProps, FlexboxProps, LayoutProps, PositionProps, SpaceProps, } from 'styled-system'; </s> add import type { IFlexProps } from './../../primitives/Flex/types'; </s> remove <StyledWrap {...newProps} flexDirection={direction} alignItems={align} justifyContent={justify} flexGrow={grow} flexBasis={basis} style={style} ref={ref} > </s> add <Flex {...props} wrap="wrap" ref={ref}>
[ "keep", "keep", "keep", "keep", "replace", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5a24a0b590292dd7e83d6645bfd874dea11c134
src/theme/components/index.ts
import Basic from './Basic';
<mask> import { storiesOf } from '@storybook/react-native'; <mask> import { withKnobs } from '@storybook/addon-knobs'; <mask> import Wrapper from '../../Wrapper'; <mask> import Usage from './Usage'; <mask> <mask> storiesOf('Fab', module) <mask> .addDecorator(withKnobs) <mask> .addDecorator((getStory: any) => <Wrapper>{getStory()}</Wrapper>) </s> Discarding FAB in favour of it being a template </s> remove export const FabContext = React.createContext({}); const Fab = ({ children, ...props }: IFabProps) => { </s> add const Fab = ({ children, icon, label, ...props }: IFabProps) => { </s> remove const IconButton = ({ icon, ...props }: IIconButtonProps, ref: any) => { </s> add const IconButton = ({ icon, label, ...props }: IIconButtonProps, ref: any) => { </s> remove import { Box } from '../../primitives'; </s> add import { Button, HStack } from '../../primitives'; </s> remove {icon} </s> add {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </s> remove <Box position="absolute" {...positioningStyle[placement]} {...newProps}> {children} </Box> </s> add <Button variant="unstyled" bg="default.200" borderRadius="full" {...newProps} // onPress={pressHandler} p={2} position="absolute" {...positioningProps[position]} {...newProps} > {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </Button>
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5d8d04854c8ce48c3b8b00b4c123a1f87d5cd09
example/storybook/stories/components/composites/Fab/index.tsx
import { Button, HStack } from '../../primitives';
<mask> import React from 'react'; <mask> import { Box } from '../../primitives'; <mask> import type { IFabProps } from './props'; <mask> <mask> import { omitUndefined } from '../../../theme/tools/utils'; <mask> <mask> export const FabContext = React.createContext({}); </s> Discarding FAB in favour of it being a template </s> remove export const FabContext = React.createContext({}); const Fab = ({ children, ...props }: IFabProps) => { </s> add const Fab = ({ children, icon, label, ...props }: IFabProps) => { </s> remove const IconButton = ({ icon, ...props }: IIconButtonProps, ref: any) => { </s> add const IconButton = ({ icon, label, ...props }: IIconButtonProps, ref: any) => { </s> remove {icon} </s> add {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </s> remove <Box position="absolute" {...positioningStyle[placement]} {...newProps}> {children} </Box> </s> add <Button variant="unstyled" bg="default.200" borderRadius="full" {...newProps} // onPress={pressHandler} p={2} position="absolute" {...positioningProps[position]} {...newProps} > {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </Button>
[ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5d8d04854c8ce48c3b8b00b4c123a1f87d5cd09
src/components/composites/Fab/Fab.tsx
const Fab = ({ children, icon, label, ...props }: IFabProps) => {
<mask> import type { IFabProps } from './props'; <mask> <mask> import { omitUndefined } from '../../../theme/tools/utils'; <mask> <mask> export const FabContext = React.createContext({}); <mask> <mask> const Fab = ({ children, ...props }: IFabProps) => { <mask> const { <mask> placement = 'bottom-right', <mask> slide = 'up', <mask> ...newProps <mask> } = omitUndefined(props); </s> Discarding FAB in favour of it being a template </s> remove import { Box } from '../../primitives'; </s> add import { Button, HStack } from '../../primitives'; </s> remove const IconButton = ({ icon, ...props }: IIconButtonProps, ref: any) => { </s> add const IconButton = ({ icon, label, ...props }: IIconButtonProps, ref: any) => { </s> remove {icon} </s> add {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </s> remove <Box position="absolute" {...positioningStyle[placement]} {...newProps}> {children} </Box> </s> add <Button variant="unstyled" bg="default.200" borderRadius="full" {...newProps} // onPress={pressHandler} p={2} position="absolute" {...positioningProps[position]} {...newProps} > {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </Button>
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5d8d04854c8ce48c3b8b00b4c123a1f87d5cd09
src/components/composites/Fab/Fab.tsx
<Button variant="unstyled" bg="default.200" borderRadius="full" {...newProps} // onPress={pressHandler} p={2} position="absolute" {...positioningProps[position]} {...newProps} > {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </Button>
<mask> slide, <mask> onToggle: () => setIsOpen(!isOpen), <mask> }} <mask> > <mask> <Box position="absolute" {...positioningStyle[placement]} {...newProps}> <mask> {children} <mask> </Box> <mask> </FabContext.Provider> <mask> ); <mask> }; <mask> <mask> export default Fab; </s> Discarding FAB in favour of it being a template </s> remove {icon} </s> add {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </s> remove const IconButton = ({ icon, ...props }: IIconButtonProps, ref: any) => { </s> add const IconButton = ({ icon, label, ...props }: IIconButtonProps, ref: any) => { </s> remove export const FabContext = React.createContext({}); const Fab = ({ children, ...props }: IFabProps) => { </s> add const Fab = ({ children, icon, label, ...props }: IFabProps) => { </s> remove import { Box } from '../../primitives'; </s> add import { Button, HStack } from '../../primitives';
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5d8d04854c8ce48c3b8b00b4c123a1f87d5cd09
src/components/composites/Fab/Fab.tsx
const IconButton = ({ icon, label, ...props }: IIconButtonProps, ref: any) => {
<mask> export type IIconButtonProps = IButtonProps & { <mask> icon?: JSX.Element; <mask> }; <mask> <mask> const IconButton = ({ icon, ...props }: IIconButtonProps, ref: any) => { <mask> const newProps = usePropsConfig('IconButton', props); <mask> return ( <mask> <Button ref={ref} {...newProps}> <mask> {icon} <mask> </Button> </s> Discarding FAB in favour of it being a template </s> remove {icon} </s> add {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </s> remove export const FabContext = React.createContext({}); const Fab = ({ children, ...props }: IFabProps) => { </s> add const Fab = ({ children, icon, label, ...props }: IFabProps) => { </s> remove import { Box } from '../../primitives'; </s> add import { Button, HStack } from '../../primitives'; </s> remove <Box position="absolute" {...positioningStyle[placement]} {...newProps}> {children} </Box> </s> add <Button variant="unstyled" bg="default.200" borderRadius="full" {...newProps} // onPress={pressHandler} p={2} position="absolute" {...positioningProps[position]} {...newProps} > {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </Button>
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5d8d04854c8ce48c3b8b00b4c123a1f87d5cd09
src/components/composites/IconButton/index.tsx
{icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )}
<mask> const IconButton = ({ icon, ...props }: IIconButtonProps, ref: any) => { <mask> const newProps = usePropsConfig('IconButton', props); <mask> return ( <mask> <Button ref={ref} {...newProps}> <mask> {icon} <mask> </Button> <mask> ); <mask> }; <mask> <mask> export default forwardRef< </s> Discarding FAB in favour of it being a template </s> remove const IconButton = ({ icon, ...props }: IIconButtonProps, ref: any) => { </s> add const IconButton = ({ icon, label, ...props }: IIconButtonProps, ref: any) => { </s> remove export const FabContext = React.createContext({}); const Fab = ({ children, ...props }: IFabProps) => { </s> add const Fab = ({ children, icon, label, ...props }: IFabProps) => { </s> remove import { Box } from '../../primitives'; </s> add import { Button, HStack } from '../../primitives'; </s> remove <Box position="absolute" {...positioningStyle[placement]} {...newProps}> {children} </Box> </s> add <Button variant="unstyled" bg="default.200" borderRadius="full" {...newProps} // onPress={pressHandler} p={2} position="absolute" {...positioningProps[position]} {...newProps} > {icon && label ? ( <HStack space={1} justifyContent="center" alignItems="center"> {icon} {label} </HStack> ) : ( icon ?? label )} </Button>
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d5d8d04854c8ce48c3b8b00b4c123a1f87d5cd09
src/components/composites/IconButton/index.tsx
borderWidth: 1,
<mask> get btnWarningColor () { <mask> return this.inverseTextColor; <mask> }, <mask> <mask> <mask> inputColor: "#000", <mask> inputBorderColor: "#000", <mask> inputHeightBase: 40, </s> lists updated with badges and avatars </s> remove borderBottomWidth: 1, padding: 8, </s> add borderBottomWidth: this.getTheme().borderWidth, padding: this.getTheme().listItemPadding, </s> remove newChildren.push(<View style={this.getRightStyle().right}> </s> add newChildren.push(<View style={ this.notePresent() ? this.getRightStyle().right : this.getRightStyle().right2 }> </s> remove fontSize: 18, </s> add fontSize: 16, }, dividerItemText: { fontSize: 16, fontWeight: '500' </s> remove fontSize: 27, </s> add fontSize: this.getTheme().iconFontSize, </s> remove if(child.props.note && this.thumbnailPresent()) { defaultProps = { style: this.getInitialStyle().itemSubNote } } else if(child.props.note) { defaultProps = { style: this.getInitialStyle().itemNote } } else { defaultProps = { style: this.getInitialStyle().itemText </s> add if (this.props.itemDivider) { defaultProps = { style: this.getInitialStyle().dividerItemText
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d7b406efa97b545e0a07e645bbf904ab3de11538
Components/Themes/light.js
listBorderColor: "#ddd", listDividerBg: "#F5F5F5", listItemPadding: 15, listNoteColor: "#58575C", iconFontSize: 27, badgeColor: "#fff", badgeBg: "#ED1727"
<mask> jumbotronPadding: 30, <mask> jumbotronBg: "#C9C9CE", <mask> <mask> contentPadding: contentPadding, <mask> <mask> listBorderColor: "#ddd" <mask> } </s> lists updated with badges and avatars </s> remove if(child.props.note && this.thumbnailPresent()) { defaultProps = { style: this.getInitialStyle().itemSubNote } } else if(child.props.note) { defaultProps = { style: this.getInitialStyle().itemNote } } else { defaultProps = { style: this.getInitialStyle().itemText </s> add if (this.props.itemDivider) { defaultProps = { style: this.getInitialStyle().dividerItemText </s> remove newChildren.push(<View style={this.getRightStyle().right}> </s> add newChildren.push(<View style={ this.notePresent() ? this.getRightStyle().right : this.getRightStyle().right2 }> </s> remove Card: Card </s> add Card: Card, Badge: Badge </s> remove color: '#58575C', </s> add color: this.getTheme().listNoteColor,
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d7b406efa97b545e0a07e645bbf904ab3de11538
Components/Themes/light.js
borderBottomWidth: this.getTheme().borderWidth, padding: this.getTheme().listItemPadding,
<mask> <mask> getInitialStyle() { <mask> return { <mask> listItem: { <mask> borderBottomWidth: 1, <mask> padding: 8, <mask> borderRadius: 1, <mask> paddingRight: 10, <mask> paddingLeft: 10, <mask> flex: 1, <mask> justifyContent: (this.buttonPresent()) ? 'space-between' : 'flex-start', </s> lists updated with badges and avatars </s> remove paddingRight: 10, paddingLeft: 10, </s> add </s> remove borderBottomWidth: 1, padding: 7, backgroundColor: '#ddd', </s> add borderBottomWidth: this.getTheme().borderWidth, padding: this.getTheme().listItemPadding, backgroundColor: this.getTheme().listDividerBg, </s> remove newChildren.push(<View style={this.getRightStyle().right}> </s> add newChildren.push(<View style={ this.notePresent() ? this.getRightStyle().right : this.getRightStyle().right2 }> </s> remove color: '#58575C', </s> add color: this.getTheme().listNoteColor,
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d7b406efa97b545e0a07e645bbf904ab3de11538
Components/Widgets/ListItem.js
<mask> listItem: { <mask> borderBottomWidth: 1, <mask> padding: 8, <mask> borderRadius: 1, <mask> paddingRight: 10, <mask> paddingLeft: 10, <mask> flex: 1, <mask> justifyContent: (this.buttonPresent()) ? 'space-between' : 'flex-start', <mask> flexDirection: 'row', <mask> alignItems: 'center', <mask> borderColor: this.getTheme().listBorderColor </s> lists updated with badges and avatars </s> remove borderBottomWidth: 1, padding: 8, </s> add borderBottomWidth: this.getTheme().borderWidth, padding: this.getTheme().listItemPadding, </s> remove borderBottomWidth: 1, padding: 7, backgroundColor: '#ddd', </s> add borderBottomWidth: this.getTheme().borderWidth, padding: this.getTheme().listItemPadding, backgroundColor: this.getTheme().listDividerBg, </s> remove fontSize: 18, </s> add fontSize: 16, }, dividerItemText: { fontSize: 16, fontWeight: '500' </s> remove color: '#58575C', </s> add color: this.getTheme().listNoteColor, </s> remove newChildren.push(<View style={this.getRightStyle().right}> </s> add newChildren.push(<View style={ this.notePresent() ? this.getRightStyle().right : this.getRightStyle().right2 }>
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/GeekyAnts/NativeBase/commit/d7b406efa97b545e0a07e645bbf904ab3de11538
Components/Widgets/ListItem.js