-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: tickets sdk embedded and modal
- Loading branch information
1 parent
2f17e3f
commit 1902d9d
Showing
7 changed files
with
104 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import React from 'react'; | ||
import { TicketsSdkEmbeddedIos } from 'react-native-ticketmaster-ignite'; | ||
|
||
const MyEvents = () => { | ||
const [initialFocus, setInitialFocus] = useState(true); | ||
|
||
useEffect(() => { | ||
// Initially, the altered Bottom Tabs View frame height is not available to Native code on iOS, this becomes available after a rerender. | ||
// If needed an additional delay can be used before setting to false | ||
setInitialFocus(false); | ||
}, []); | ||
|
||
return <>{!initialFocus && <TicketsSdkEmbeddedIos style={{ flex: 1 }} />}</>; | ||
return <TicketsSdkEmbeddedIos style={{ flex: 1 }} />; | ||
}; | ||
|
||
export default MyEvents; |
This file was deleted.
Oops, something went wrong.
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,10 +1,31 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { ViewStyle } from 'react-native'; | ||
import { requireNativeComponent, ViewProps } from 'react-native'; | ||
|
||
interface RNTTicketsSdkEmbeddedViewProps extends ViewProps { | ||
style: Record<string, any>; | ||
style: ViewStyle; | ||
} | ||
|
||
export const TicketsSdkEmbeddedIos = | ||
requireNativeComponent<RNTTicketsSdkEmbeddedViewProps>( | ||
'RNTTicketsSdkEmbeddedView' | ||
); | ||
type TicketsSdkEmbeddedIosProps = { | ||
style?: ViewStyle; | ||
renderTimeDelay?: number | undefined; | ||
}; | ||
|
||
const TicketsSdk = requireNativeComponent<RNTTicketsSdkEmbeddedViewProps>( | ||
'RNTTicketsSdkEmbeddedView' | ||
); | ||
|
||
export const TicketsSdkEmbeddedIos = ({ | ||
style, | ||
renderTimeDelay, | ||
}: TicketsSdkEmbeddedIosProps) => { | ||
const [initialFocus, setInitialFocus] = useState(true); | ||
|
||
useEffect(() => { | ||
// Initially, the altered Bottom Tabs View frame height is not available to Native code on iOS, this becomes available after a rerender. | ||
// If needed an additional delay can be used before setting to false | ||
setTimeout(() => setInitialFocus(false), renderTimeDelay || 0); | ||
}, [renderTimeDelay]); | ||
|
||
return <>{!initialFocus && <TicketsSdk style={style || { flex: 1 }} />}</>; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React, { useEffect } from 'react'; | ||
import { requireNativeComponent, View } from 'react-native'; | ||
|
||
const TicketsSdk = requireNativeComponent('RNTTicketsSdkView'); | ||
|
||
type TicketsSdkModalProps = { | ||
showTicketsModal: boolean; | ||
setShowTicketsModal: (arg0: boolean) => void; | ||
}; | ||
|
||
export const TicketsSdkModal = ({ | ||
showTicketsModal, | ||
setShowTicketsModal, | ||
}: TicketsSdkModalProps) => { | ||
useEffect(() => { | ||
setShowTicketsModal(showTicketsModal); | ||
setTimeout(() => { | ||
setShowTicketsModal(false); | ||
}, 500); | ||
}, [showTicketsModal, setShowTicketsModal]); | ||
|
||
return ( | ||
<> | ||
{showTicketsModal && ( | ||
<View> | ||
<TicketsSdk /> | ||
</View> | ||
)} | ||
</> | ||
); | ||
}; |
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