-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from pushpender-singh-ap/featurs
Introduced flashlight control and camera release commands (ANDROID ONLY)
- Loading branch information
Showing
5 changed files
with
197 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,30 @@ | ||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; | ||
import type { ViewProps } from 'react-native'; | ||
import type { ViewProps, HostComponent } from 'react-native'; | ||
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes'; | ||
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands'; | ||
|
||
type Event = Readonly<{ | ||
value: string; | ||
}>; | ||
|
||
interface NativeCommands { | ||
enableFlashlight: ( | ||
viewRef: React.ElementRef<HostComponent<NativeProps>> | ||
) => Promise<void>; | ||
disableFlashlight: ( | ||
viewRef: React.ElementRef<HostComponent<NativeProps>> | ||
) => Promise<void>; | ||
releaseCamera: ( | ||
viewRef: React.ElementRef<HostComponent<NativeProps>> | ||
) => Promise<void>; | ||
} | ||
|
||
interface NativeProps extends ViewProps { | ||
onQrScanned?: DirectEventHandler<Event>; // Event name should start with "on" | ||
} | ||
|
||
export const Commands = codegenNativeCommands<NativeCommands>({ | ||
supportedCommands: ['enableFlashlight', 'disableFlashlight', 'releaseCamera'], | ||
}); | ||
|
||
export default codegenNativeComponent<NativeProps>('ReactNativeScannerView'); |