sthima-native
v0.0.24
Published
Sthima's component librery
Downloads
13
Readme
sthima-native
Sthima's component librery
components
SInput
SForm
SFacebookBtn
SAppleBtn
SEmailBtn
SToast
Simple toast messager
import React from "react";
import { Button, View } from 'react-native';
import {SToast} from 'sthima-native';
const App = () => {
return (
<View style={{flex: 1}}>
<Button title={'Show toast'} onPress={() => SToast.show("This is a toast")}/>
</View>
)
}
export default App;
Roles
Decides whether to render its children components based on a list of roles.
import React from "react";
import { View } from 'react-native';
import {SText, SRoles, SConfig} from 'sthima-native';
SConfig.userRoles = ['admin'];
const App = () => {
return (
<View style={{flex: 1}}>
{/* Will take the roles on SConfig.userRoles */}
<SRoles roles={["admin", "superAdmin"]}>
<SText>Will render, has permission</SText>
</SRoles>
{/* Will take the roles on SConfig.userRoles */}
<SRoles roles={["superAdmin"]}>
<SText>will not render render</SText>
</SRoles>
{/* Will take the userRoles injected */}
<SRoles roles={["superAdmin"]} userRoles={["superAdmin"]}>
<SText>Exlusive to superAdmin Text but with direct role injection</SText>
</SRoles>
</View>
)
}
export default App;
Utils
SFetch
SConfig
SFont
SDebug
This class allows you to have more control over what it's printed out on the debugger. Set the debug level on SDebug.debugLevel
with one of these options
export enum SDebugLevel {
log,
info,
warn,
error,
silent,
}
and them use Debug instead on console:
import {SDebug, SDebugLevel} from 'sthima-native'
SDebug.debugLevel = SDebugLevel.warn;
SDebug.log('Will not be printed');
SDebug.warn('This one will be printed');