Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@archireport/react-native-svg-draw
Advanced tools
React Native drawing component based on SVG with editable annotations
React Native drawing component based on SVG with editable annotations
Expo
react-native-reanimated
v2react-native-view-shot
npm install @archireport/react-native-svg-draw react-native-reanimated react-native-gesture-handler react-native-svg react-native-view-shot react-native-linear-gradient
expo install @archireport/react-native-svg-draw react-native-reanimated react-native-gesture-handler react-native-svg react-native-view-shot expo-linear-gradient
⚠️ extra steps are required
React Native Gesture Handler needs extra steps to finalize its installation, please follow their installation instructions.
React Native Reanimated needs extra steps to finalize its installation, please follow their installation instructions.
import { DrawWithOptions } from 'react-native-svg-draw';
import LinearGradient from 'react-native-linear-gradient';
// ...
<DrawWithOptions linearGradient={LinearGradient} />
import { DrawWithOptions } from 'react-native-svg-draw';
import { LinearGradient } from 'expo-linear-gradient';
// ...
<DrawWithOptions linearGradient={LinearGradient} />
You have 2 options
Fast and easy way to use the lib. Example :
<DrawWithOptions
linearGradient={LinearGradient}
image={require('./pexels-sebastian-palomino-2847766.jpg')}
close={() => true}
takeSnapshot={(snap) => {
snap.then((uri) => console.log('snapShot uri:', uri));
}}
/>
You can create your own "DrawWithOptions" component and customize the ui.
You will need to use DrawCore
component wrapped in DrawProvider
context.
<DrawProvider>
<DrawCore image={require('./pexels-sebastian-palomino-2847766.jpg')}/>
</DrawProvider>
Then you can use the hook "useDrawHook" inside your components to interact with the context. This hook expose a lot of functions and objects that can be used to interact with the DrawCore
.
const {
drawState,
dispatchDrawStates,
itemIsSelected,
cancelLastAction,
deleteSelectedItem,
...
} = useDrawHook();
Name | Type | Description |
---|---|---|
strokeWidth | shared value(number) | Object from react-native-reanimated, get and set value => strokeWidth.value |
color | shared value(hslColor) | Object from react-native-reanimated, get and set value => color.value |
onColorStrokeChange | function | Function use when changing color or strokeWidth is done to memorize action for undo |
drawState | object | Get the selected drawingMode : 'singleHead','doubleHead','rectangle','ellipse','text','pen', cancelEnabled is true when last action can be canceled, doneItems contains all previous draw items and screenStates helps to go back in time (cancel pops last state) |
dispatchDrawStates | function | Can be used to update drawingMode |
itemIsSelected | shared value(boolean) | Object from react-native-reanimated Indicate if an item is selected, to get value => itemIsSelected.value |
cancelLastAction | function | Call this function when user press your undo button |
takeSnapshot | function | This async function will return the uri of your drawing |
deleteSelectedItem | function | Call this function when you want to delete the selected item |
Copy the drawWithOptions component, sliders component and adjust styles to match your theme
Component with header and footer, based on DrawCore
Name | Type | Description |
---|---|---|
close | function | (optional) called when cross is pressed |
takeSnapshot | function | (optional) called when send button (at the top right) is pressed |
linearGradient | React Component | implementation used for linear gradient (differs between expo and bare react native app) |
image | image | (optional) background picture |
backgroundColor | string | (optional) background color of the draw zone |
Component where the user can draw
Name | Type | Description |
---|---|---|
image | image | (optional) background picture |
backgroundColor | string | (optional) background color of the draw zone |
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
FAQs
React Native drawing component based on SVG with editable annotations
The npm package @archireport/react-native-svg-draw receives a total of 76 weekly downloads. As such, @archireport/react-native-svg-draw popularity was classified as not popular.
We found that @archireport/react-native-svg-draw demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.