Skip to content
Open

Main #79

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
173fb32
Update package.json web view versions
raphaelobinna Aug 1, 2024
5f3cb37
Update package.json
raphaelobinna Aug 18, 2024
0400bbe
Update package.json
raphaelobinna Aug 18, 2024
de53c15
Update package.json
raphaelobinna Aug 18, 2024
e52bafd
Update FlutterwaveCheckout.tsx
raphaelobinna Aug 31, 2025
e44cd67
Update FlutterwaveCheckout.tsx
raphaelobinna Aug 31, 2025
0f652b3
Update FlutterwaveCheckout.tsx
raphaelobinna Aug 31, 2025
97b1cc8
Update FlutterwaveCheckout.tsx
raphaelobinna Aug 31, 2025
dcc80ad
Update FlutterwaveCheckout.js
raphaelobinna Aug 31, 2025
c26019b
Update FlutterwaveCheckout.js
raphaelobinna Aug 31, 2025
d0c44af
Update FlutterwaveCheckout.tsx
raphaelobinna Aug 31, 2025
67f8e3f
Update FlutterwaveCheckout.tsx
raphaelobinna Aug 31, 2025
84560f5
Update FlutterwaveCheckout.js
raphaelobinna Aug 31, 2025
8831b48
fix typesccript errors
raphaelobinna Sep 6, 2025
197d487
fix modal closing
raphaelobinna Sep 6, 2025
c5eda98
fix modal canceling
raphaelobinna Sep 6, 2025
6afef7c
fix modal canceling
raphaelobinna Sep 6, 2025
d4a7a34
fix modal canceling 2
raphaelobinna Sep 6, 2025
69f566e
fix modal canceling 3
raphaelobinna Sep 6, 2025
ca2d8c5
fix modal canceling 4
raphaelobinna Sep 6, 2025
318ed71
fix modal canceling 5
raphaelobinna Sep 6, 2025
fe197a5
fix modal canceling 6
raphaelobinna Sep 6, 2025
749d41f
test again
raphaelobinna Sep 11, 2025
290322b
try another
raphaelobinna Sep 13, 2025
bcb85ab
try agian
raphaelobinna Sep 13, 2025
6022447
try now
raphaelobinna Sep 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dist/FlutterwaveButton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ interface FlutterwaveButtonProps {
disabled?: boolean;
alignLeft?: boolean;
onPress?: () => void;
children?: React.ReactNode;
}
declare const FlutterwaveButton: React.FC<FlutterwaveButtonProps>;
export default FlutterwaveButton;
Expand Down
2 changes: 1 addition & 1 deletion dist/FlutterwaveButton.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 14 additions & 16 deletions dist/FlutterwaveButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ var FlutterwaveButton = function FlutterwaveButton(_a) {
var style = _a.style, alignLeft = _a.alignLeft, children = _a.children, disabled = _a.disabled, onPress = _a.onPress;
// render primary button
return (<TouchableHighlight underlayColor={colors.primaryLight} disabled={disabled} onPress={onPress} style={[
styles.button,
disabled ? styles.buttonBusy : {},
alignLeft ? styles.buttonAlignLeft : {},
style
]} activeOpacity={1} testID='flw-button'>
styles.button,
disabled ? styles.buttonBusy : {},
alignLeft ? styles.buttonAlignLeft : {},
style,
]} activeOpacity={1} testID="flw-button">
<>
{children ? children : (<Image source={pryContent} resizeMode="contain" resizeMethod="resize" style={styles.buttonContent} fadeDuration={0}/>)}
{disabled
? (<View style={styles.buttonBusyOvelay}/>)
: null}
{children ? (children) : (<Image source={pryContent} resizeMode="contain" resizeMethod="resize" style={styles.buttonContent} fadeDuration={0}/>)}
{disabled ? <View style={styles.buttonBusyOvelay}/> : null}
</>
</TouchableHighlight>);
</TouchableHighlight>);
};
// component UI styles
var styles = StyleSheet.create({
Expand All @@ -28,13 +26,13 @@ var styles = StyleSheet.create({
top: 0,
bottom: 0,
right: 0,
backgroundColor: 'rgba(255, 255, 255, 0.6)'
backgroundColor: 'rgba(255, 255, 255, 0.6)',
},
buttonBusy: {
borderColor: colors.primaryLight
borderColor: colors.primaryLight,
},
buttonAlignLeft: {
justifyContent: 'flex-start'
justifyContent: 'flex-start',
},
button: {
paddingHorizontal: 16,
Expand All @@ -47,13 +45,13 @@ var styles = StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'row',
overflow: 'hidden'
overflow: 'hidden',
},
buttonContent: {
resizeMode: 'contain',
width: 187.3,
height: 187.3 / contentSizeDimension
}
height: 187.3 / contentSizeDimension,
},
});
// export component as default
export default FlutterwaveButton;
2 changes: 1 addition & 1 deletion dist/FlutterwaveCheckout.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 72 additions & 40 deletions dist/FlutterwaveCheckout.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ var FlutterwaveCheckout = function FlutterwaveCheckout(props) {
Animated.timing(animation.current, {
toValue: 1,
duration: 700,
easing: Easing["in"](Easing.elastic(0.72)),
useNativeDriver: false
easing: Easing.in(Easing.elastic(0.72)),
useNativeDriver: false,
}).start();
}, []);
var animateOut = React.useCallback(function () {
return new Promise(function (resolve) {
Animated.timing(animation.current, {
toValue: 0,
duration: 400,
useNativeDriver: false
useNativeDriver: false,
}).start(function () {
setShow(false);
resolve();
Expand All @@ -59,15 +59,30 @@ var FlutterwaveCheckout = function FlutterwaveCheckout(props) {
Alert.alert('', 'Are you sure you want to cancel this payment?', [
{ text: 'No' },
{
text: 'Yes, Cancel',
text: 'Yes',
style: 'destructive',
onPress: function () { return handleAbort(true); }
onPress: function () { return handleAbort(true); },
},
]);
return;
}
// remove tx_ref and dismiss
animateOut().then(onAbort);
// animateOut()
// if(onAbort){
// setTimeout(() => {
// onAbort();
// }, 500);
// }
if (webviewRef.current) {
webviewRef.current.stopLoading();
}
// Stop animations
animation.current.stopAnimation();
// Close modal after cleanup
setTimeout(function () { return setShow(false); }, 50);
if (onAbort) {
onAbort();
}
}, [onAbort, animateOut]);
var handleNavigationStateChange = React.useCallback(function (ev) {
// cregex to check if redirect has occured on completion/cancel
Expand All @@ -77,11 +92,28 @@ var FlutterwaveCheckout = function FlutterwaveCheckout(props) {
return true;
}
// dismiss modal
animateOut().then(function () {
if (onRedirect) {
onRedirect(getRedirectParams(ev.url));
}
});
// animateOut().then(() => {
// if (onRedirect) {
// // let a = getRedirectParams(ev.url);
// let url = JSON.stringify(ev.url);
// Alert.alert(url);
// if (onAbort) {
// onAbort();
// return;
// }
// // onRedirect(a);
// }
// });
animation.current.stopAnimation();
// Close modal after cleanup
setTimeout(function () { return setShow(false); }, 50);
var a = getRedirectParams(ev.url);
if (onRedirect) {
onRedirect(a);
}
// if (onAbort) {
// onAbort();
// }
return false;
}, [onRedirect]);
var doAnimate = React.useCallback(function () {
Expand All @@ -99,35 +131,35 @@ var FlutterwaveCheckout = function FlutterwaveCheckout(props) {
}, [doAnimate]);
var marginTop = animation.current.interpolate({
inputRange: [0, 1],
outputRange: [windowHeight, 0]
outputRange: [windowHeight, 0],
});
var opacity = animation.current.interpolate({
inputRange: [0, 0.3, 1],
outputRange: [0, 1, 1]
outputRange: [0, 1, 1],
});
return (<Modal transparent={true} animated={false} hardwareAccelerated={false} visible={show}>
<FlutterwaveCheckoutBackdrop onPress={function () { return handleAbort(); }} animation={animation.current}/>
<Animated.View style={[
styles.webviewContainer,
{
marginTop: marginTop,
opacity: opacity
}
]} testID='flw-checkout-dialog'>
<WebView ref={webviewRef} source={{ uri: link || '' }} style={styles.webview} startInLoadingState={true} scalesPageToFit={true} javaScriptEnabled={true} onShouldStartLoadWithRequest={handleNavigationStateChange} renderError={function () { return <FlutterwaveCheckoutError hasLink={!!link} onTryAgain={handleReload}/>; }} renderLoading={function () { return <FlutterwaveCheckoutLoader />; }}/>
</Animated.View>
</Modal>);
<FlutterwaveCheckoutBackdrop onPress={function () { return handleAbort(); }} animation={animation.current}/>
<Animated.View style={[
styles.webviewContainer,
{
marginTop: marginTop,
opacity: opacity,
},
]} testID="flw-checkout-dialog">
<WebView ref={webviewRef} source={{ uri: link || '' }} style={styles.webview} startInLoadingState={true} scalesPageToFit={true} javaScriptEnabled={true} onShouldStartLoadWithRequest={handleNavigationStateChange} renderError={function () { return (<FlutterwaveCheckoutError hasLink={!!link} onTryAgain={handleReload}/>); }} renderLoading={function () { return <FlutterwaveCheckoutLoader />; }}/>
</Animated.View>
</Modal>);
};
var FlutterwaveCheckoutBackdrop = function FlutterwaveCheckoutBackdrop(_a) {
var animation = _a.animation, onPress = _a.onPress;
// Interpolation backdrop animation
var backgroundColor = animation.interpolate({
inputRange: [0, 0.3, 1],
outputRange: [colors.transparent, colors.transparent, 'rgba(0,0,0,0.5)']
outputRange: [colors.transparent, colors.transparent, 'rgba(0,0,0,0.5)'],
});
return (<TouchableWithoutFeedback testID='flw-checkout-backdrop' onPress={onPress}>
<Animated.View style={Object.assign({}, styles.backdrop, { backgroundColor: backgroundColor })}/>
</TouchableWithoutFeedback>);
return (<TouchableWithoutFeedback testID="flw-checkout-backdrop" onPress={onPress}>
<Animated.View style={Object.assign({}, styles.backdrop, { backgroundColor: backgroundColor })}/>
</TouchableWithoutFeedback>);
};
export var FlutterwaveCheckoutError = function (_a) {
var hasLink = _a.hasLink, onTryAgain = _a.onTryAgain;
Expand All @@ -153,17 +185,17 @@ var styles = StyleSheet.create({
errorActionButtonText: {
textAlign: 'center',
color: colors.primary,
fontSize: 16
fontSize: 16,
},
errorActionButton: {
paddingHorizontal: 16,
paddingVertical: 16
paddingVertical: 16,
},
errorText: {
color: colors.secondary,
textAlign: 'center',
marginBottom: 32,
fontSize: 18
fontSize: 18,
},
error: {
position: 'absolute',
Expand All @@ -174,19 +206,19 @@ var styles = StyleSheet.create({
backgroundColor: '#ffffff',
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 56
paddingHorizontal: 56,
},
backdrop: {
position: 'absolute',
left: 0,
right: 0,
bottom: 0,
top: 0
top: 0,
},
loadingImage: {
width: 64,
height: 64,
resizeMode: 'contain'
resizeMode: 'contain',
},
loading: {
position: 'absolute',
Expand All @@ -196,20 +228,20 @@ var styles = StyleSheet.create({
left: 0,
backgroundColor: 'rgba(255, 255, 255, 0.3)',
justifyContent: 'center',
alignItems: 'center'
alignItems: 'center',
},
webviewContainer: {
top: Platform.select({ ios: 96, android: 64 }),
top: Platform.select({ ios: 96, android: 64 }), // status bar height aware for ios
flex: 1,
backgroundColor: '#efefef',
paddingBottom: Platform.select({ ios: 96, android: 64 }),
paddingBottom: Platform.select({ ios: 96, android: 64 }), // status bar height aware for ios
overflow: 'hidden',
borderTopLeftRadius: windowHeight * borderRadiusDimension,
borderTopRightRadius: windowHeight * borderRadiusDimension
borderTopRightRadius: windowHeight * borderRadiusDimension,
},
webview: {
flex: 1,
backgroundColor: 'rgba(0,0,0,0)'
}
backgroundColor: 'rgba(0,0,0,0)',
},
});
export default FlutterwaveCheckout;
5 changes: 2 additions & 3 deletions dist/FlutterwaveInit.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="react-native" />
export declare type Currency = 'AUD' | 'BIF' | 'CDF' | 'CAD' | 'CVE' | 'EUR' | 'GBP' | 'GHS' | 'GMD' | 'GNF' | 'KES' | 'LRD' | 'MWK' | 'MZN' | 'NGN' | 'RWF' | 'SLL' | 'STD' | 'TZS' | 'UGX' | 'USD' | 'XAF' | 'XOF' | 'ZAR' | 'ZMK' | 'ZMW' | 'ZWD';
export type Currency = 'AUD' | 'BIF' | 'CDF' | 'CAD' | 'CVE' | 'EUR' | 'GBP' | 'GHS' | 'GMD' | 'GNF' | 'KES' | 'LRD' | 'MWK' | 'MZN' | 'NGN' | 'RWF' | 'SLL' | 'STD' | 'TZS' | 'UGX' | 'USD' | 'XAF' | 'XOF' | 'ZAR' | 'ZMK' | 'ZMW' | 'ZWD';
export interface FlutterwaveInitSubAccount {
id: string;
transaction_split_ratio?: number;
Expand Down Expand Up @@ -28,7 +27,7 @@ export interface FlutterwaveInitCustomizations {
logo?: string;
description?: string;
}
export declare type FlutterwaveInitOptions = FlutterwaveInitOptionsBase & {
export type FlutterwaveInitOptions = FlutterwaveInitOptionsBase & {
authorization: string;
tx_ref: string;
customer: FlutterwaveInitCustomer;
Expand Down
2 changes: 1 addition & 1 deletion dist/FlutterwaveInit.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading