amplify pull --appId [ID] --envName [STAGE]
Current Amplify application ID: d1wuoz62t4xvj0
Current Amplify environment: staging
- can get picture from media library
- no ability to customize camera screen
- can get only photo & video from camera
- can customize camera screen and native camera settings
Basic rules
- Use functional components
- Use arrow functions
- Use parentheses when they span more than one line
- Never use
letorvar(constonly) - Never use
interface. Use onlytype
// ❌ bad
const Title = ({ text }) => <Text style={styles.title}>
{text}
</Text>
// ✅ good
const Title = ({ text }) => (
<Text style={styles.title}>
{text}
</Text>
)
// ❌ bad
<Foo superLongParam='bar'
anotherSuperLongParam='baz' />
// ✅ good
<Foo
superLongParam='bar'
anotherSuperLongParam='baz'
/>
// ❌ bad
{showButton &&
<Button />
}
// ❌ bad
{
showButton &&
<Button />
}
// ✅ good
{showButton && (
<Button />
)}
// ✅ good
{showButton && <Button />}
// ✅ good
{someReallyLongConditional
&& anotherLongConditional
&& (
<Foo
superLongParam='bar'
anotherSuperLongParam='baz'
/>
)
}
// ✅ good
{someConditional ? (
<Foo />
) : (
<Foo
superLongParam='bar'
anotherSuperLongParam='baz'
/>
)}Function name is always a verb or verb expression
// ❌ bad
isNumber(2)
// ✅ good
getIsNumber(5)
// ✅ good
validateNumber(7)Boolean must have prefix with: is, has, can, should e.t.c. (dont use adjectives like hidden, removable)
// ❌ bad
const person = true
const age = true
const dance = true
// ✅ good
const isPerson = true
const hasAge = true
const canDance = trueThe name should always be a representation of the data essence
// ❌ bad
const phoneNumber = 'John Doe'
// ✅ good
const phoneNumber = '081299997777'Use capitalize letters only for constants
// ❌ bad
const AUTHORIZATION = useAuthVar()
// ✅ good
const LIMIT = 10Hooks Naming
Hooks ALWAYS starts with use prefix
// ❌ bad
const authorization = authVar()
// ✅ good
const authorization = useAuthVar()useState() return value is an array. First element is a variable and second is a function setter which always start with set prefix
// ❌ bad
const [isErrorModalShown, togleErrorModalShow] = useState(false)
// ✅ good
const [isErrorModalShown, setIsErrorModalShow] = useState(false)Stylesheet.create({}) return object with styles name. Param object has only camelCase keys. Style key should not contain style in the name.
// ❌ bad
const myComponentStyles = Stylesheet.create({
submit_red_button_style: {
width: '100%',
backgroundColor: 'red'
},
})
// ✅ good
const styles = Stylesheet.create({
submitRedButton: {
width: '100%',
backgroundColor: 'red'
},
})